Forum Discussion
Lookupvalue returns nonsense value
- Anonymous5 years ago
Hi Anonymous ,
LOOKUPVALUE() function could not return more than one distinct value. As Greg_Deckler suggested, you could use MAXX() instead. Or SUMX(), FIRSTNONBLANK() and so on like this:
Distincttable = ADDCOLUMNS ( DISTINCT ( 'UNION'[Sales Doc.] ), "MAX Net Value", MAXX ( FILTER ( 'UNION', 'UNION'[Sales Doc.] = EARLIER ( 'UNION'[Sales Doc.] ) ), [Net value] ), "SUM Net Value", SUMX ( FILTER ( 'UNION', 'UNION'[Sales Doc.] = EARLIER ( 'UNION'[Sales Doc.] ) ), [Net value] ), "FIRST Net Value", FIRSTNONBLANK ( 'UNION'[Net value], 1 ) )The final output is shown below:
Please take a look at the pbix file here.
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous ,
LOOKUPVALUE() function could not return more than one distinct value. As Greg_Deckler suggested, you could use MAXX() instead. Or SUMX(), FIRSTNONBLANK() and so on like this:
Distincttable =
ADDCOLUMNS (
DISTINCT ( 'UNION'[Sales Doc.] ),
"MAX Net Value",
MAXX (
FILTER ( 'UNION', 'UNION'[Sales Doc.] = EARLIER ( 'UNION'[Sales Doc.] ) ),
[Net value]
),
"SUM Net Value",
SUMX (
FILTER ( 'UNION', 'UNION'[Sales Doc.] = EARLIER ( 'UNION'[Sales Doc.] ) ),
[Net value]
),
"FIRST Net Value", FIRSTNONBLANK ( 'UNION'[Net value], 1 )
)
The final output is shown below:
Please take a look at the pbix file here.
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous5 years agoNot applicable
Thanks Anonymous Evelyn for the great support!
I had to play around with the expression a little but it looked like it worked...
I mean it does a good job and picks all the Sales Docs.& it also looks like it retrieves the correspondign Net Values but unfortuntely not all as it seems... I aggregated the values manually in the raw tables and the number PowerBI gives me is roughly 4 times the number it should be and I have absolutely no idea why that is...!
And yeah, I double-checked my measures as well as the Excel-functions I used to calculate by hand...