Forum Discussion
Dax error
Hi,
I have created the below Dax, which is throwing some errors, not sure what I am doing incorrectly
IF (
SELECTEDVALUE ( WkTbl[Column] ) = TRUE (),
CALCULATE ( COUNTA ( 'Current HC'[GPN] ), MAX ( 'Current HC'[Weeknumber] ) )
)
Hi vjnvinod ,
You canAccording to your formula, for MAX ( 'Current HC'[Weeknumber] ), how exactly do you want to achieve the filtering condition.
One is to group the Weeknumber fields and find the total value corresponding to each group; the other case is to find the total value corresponding to the maximum Weeknumber.
M1 = VAR max_ = MAX ( 'Current HC'[Weeknumber] ) RETURN IF ( SELECTEDVALUE ( 'Current HC'[column] ) = TRUE (), CALCULATE ( COUNTA ( 'Current HC'[GPN] ), FILTER ( ALL ( 'Current HC' ), 'Current HC'[Weeknumber] = max_ ) ) )M2 = IF ( SELECTEDVALUE ( 'Current HC'[column] ) = TRUE (), CALCULATE ( COUNTA ( 'Current HC'[GPN] ), FILTER ( ALL ( 'Current HC' ), 'Current HC'[Weeknumber] = MAX ( 'Current HC'[Weeknumber] ) ) ) )
If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.
Best Regards,
Henry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
4 Replies
- mh2587Super User
Filter(table name,SELECTEDVALUE ( WkTbl[Column] ) = TRUE ())
- vjnvinodImpactful Individual
- Samarth_18Community Champion
Hi vjnvinod ,
Please try this:-
Current HCount = IF ( SELECTEDVALUE ( WkTbl[Column] ) = TRUE (), CALCULATE ( COUNTA ( 'Current HC'[GPN] ), FILTER ( 'Current HC', 'Current HC'[Weeknumber] = MAX ( 'Current HC'[Weeknumber] ) ) ) )Thanks,
Samarth
- v-henryk-mstfCommunity Support
Hi vjnvinod ,
You canAccording to your formula, for MAX ( 'Current HC'[Weeknumber] ), how exactly do you want to achieve the filtering condition.
One is to group the Weeknumber fields and find the total value corresponding to each group; the other case is to find the total value corresponding to the maximum Weeknumber.
M1 = VAR max_ = MAX ( 'Current HC'[Weeknumber] ) RETURN IF ( SELECTEDVALUE ( 'Current HC'[column] ) = TRUE (), CALCULATE ( COUNTA ( 'Current HC'[GPN] ), FILTER ( ALL ( 'Current HC' ), 'Current HC'[Weeknumber] = max_ ) ) )M2 = IF ( SELECTEDVALUE ( 'Current HC'[column] ) = TRUE (), CALCULATE ( COUNTA ( 'Current HC'[GPN] ), FILTER ( ALL ( 'Current HC' ), 'Current HC'[Weeknumber] = MAX ( 'Current HC'[Weeknumber] ) ) ) )
If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.
Best Regards,
Henry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.