Forum Discussion
Anonymous
3 years agoNot applicable
EARLIER Function not working
Dear Power BI heroes, I have a question regarding the EARLIER function. I have the following DAX query: Unieke waarde = CALCULATE(DISTINCTCOUNT('AUDIT line'[Amnt]), FILTER(ALL('AUDIT line'...
- 3 years ago
Anonymous
An alternative version that uses EARLIER as you initially intended:
Unieke waarde V3 = CALCULATE ( DISTINCTCOUNT ( 'AUDIT line'[Amnt] ), FILTER ( ALL ( 'AUDIT line' ), CALCULATE (COUNT ( 'AUDIT line'[Amnt] ), 'AUDIT line'[Amnt] = EARLIER('AUDIT line'[Amnt] ), ALL('AUDIT line')) = 1 ) )or the same using variables instead of EARLIER, which is recommended nowadays:
Unieke waarde V3B = CALCULATE ( DISTINCTCOUNT ( 'AUDIT line'[Amnt] ), FILTER ( ALL ( 'AUDIT line' ), VAR amnt_ = 'AUDIT line'[Amnt] RETURN CALCULATE (COUNT ( 'AUDIT line'[Amnt] ), 'AUDIT line'[Amnt] = amnt_ , ALL('AUDIT line')) = 1 ) )Please accept the solution when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
AlB
3 years agoCommunity Champion
Anonymous
An alternative version that uses EARLIER as you initially intended:
Unieke waarde V3 =
CALCULATE (
DISTINCTCOUNT ( 'AUDIT line'[Amnt] ),
FILTER (
ALL ( 'AUDIT line' ),
CALCULATE (COUNT ( 'AUDIT line'[Amnt] ), 'AUDIT line'[Amnt] = EARLIER('AUDIT line'[Amnt] ), ALL('AUDIT line')) = 1
)
)
or the same using variables instead of EARLIER, which is recommended nowadays:
Unieke waarde V3B =
CALCULATE (
DISTINCTCOUNT ( 'AUDIT line'[Amnt] ),
FILTER (
ALL ( 'AUDIT line' ),
VAR amnt_ = 'AUDIT line'[Amnt]
RETURN
CALCULATE (COUNT ( 'AUDIT line'[Amnt] ), 'AUDIT line'[Amnt] = amnt_ , ALL('AUDIT line')) = 1
)
)
|
|
Please accept the solution when done and consider giving a thumbs up if posts are helpful. Contact me privately for support with any larger-scale BI needs, tutoring, etc. |