I have a two tables are Data and Report.
Data Table: In Data table two columns are Item ,Qty and Order. The Item columns contain as a text & number and qty and number column stored as text and number.
The item column repeated according to the order and the same item column contain two different qty according to the order column.
Report Table:
I have a unique item column.
Data and Report file look like.
Data
ITEM QTY ORDER
123 200 1
123 210 0
5678 220 1
5678 230 0
5555 240 1
6666 250 1
9876 260 1
2345 270 1
901 280 1
901 280 1
902 300 1
902 300 1
123456 200 1
123456 200 1
123456 210 1
123456 210 1
123456 0 1
567 200 1
567 210 1
567 210 1
567 0 1
453 5000 1
453 5000 1
453 5000 1
453 5000 1
112 5000 1
112 5000 1
112 5000 1
112 5000 1
116 5000 1
116 5001 1
116 0 1
116 0 1
116 5000 0
116 5001 0
116 0 0
116 0 0
Report
ITEM DESIRED RESULT (QTY)
123 200
5678 220
5555 240
6666 250
9876 260
2345 270
901 280
902 300
123456 MIXED
567 MIXED
4444 NA
12 NA
10 NA
453 5000
112 5000
116 MIXEDDesired Result
I would like to pull the qty against the order “1” from data table into the report table according to the item.
If item found in data table then return the qty in report table according to the item. {Please refer the “Data” and “Report table for item 123 and 5678 etc….}
If item not found in data table then return “NA” in report table according to the item. {Please refer the “Data” and “Report table for item 10, 12,444}
The same item contain two different qty then return as a text “Mixed” in report table according to the item. {Please refer the “Data” and “Report table for item 123456 ,116 & 567}
Currently I am using the following calculated column CURRENT DAX FOR QTY = LOOKUPVALUE(DATA[QTY],DATA[ITEM],'DESIRED RESULT'[ITEM],DATA[ORDER],1,"NA") 
It’s almost working fine but it’s giving wrong result “NA” were two different qty for the same item & two different order (0,1) or (1) or (o) {Please refer the “Data” and “Report table for item 123456, 116 & 567} but the desired result is “Mixed” those three items.
Note: I convert the qty column from number to text otherwise it's give an error, is there any alternative option to achieve my result.
Herewith attached the PBI file for your reference https://www.dropbox.com/s/hf40q27pvn3ij2g/DAX-LOOKUPVALUE%20FILTER%20BY.pbix?dl=0.
Aucun commentaire:
Enregistrer un commentaire