Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello
I want to retrieve two things: value at recent date, and the date, where the value was at the highest. I have achieved the first by a measure. However, when I try to retrieve the date with max value, I am unable to do so. The following is the code that works:
Value at recent date = CALCULATE( SUM('inStock'[Value]); FILTER('inStock';'inStock'[DateFirstSaved] = MAX('inStock'[DateFirstSaved])))
The following is what does not work:
Max value = CALCULATE( SUM('inStock'[Value]); FILTER('inStock';'inStock'[DateFirstSaved] = MAX('inStock'[Value])))
Can anyone help me achieve this?
Please try this
Max value = VAR myvalue = [Value at recent date] RETURN CALCULATE ( FIRSTNONBLANK ( 'inStock'[DateFirstSaved], 1 ), FILTER ( ALLSELECTED ( 'inStock'[DateFirstSaved] ), CALCULATE ( SUM ( inStock[Value] ) ) = myvalue ) )
I am trying it out right now. However I experienced, that it will not accept 1 in FIRSTNONBLANK.
It should. Even you could out 0, TRUE()
Could you share the screen shot?
HI @BiBra
Replace
FIRSTNONBLANK ( 'inStock'[DateFirstSaved], 1 )
With
Values('inStock'[DateFirstSaved])
or
MAX('inStock'[DateFirstSaved])
No errors in the code now. However it cannot display
Hi @BiBra,
Please share some sample data and pbix file for further test.
Regards,
Xiaoxin Sheng
or replace the comma with
FIRSTNONBLANK ( 'inStock'[DateFirstSaved]; 1 )
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
103 | |
77 | |
66 | |
63 |
User | Count |
---|---|
142 | |
105 | |
102 | |
81 | |
68 |