Forum Discussion

tinker's avatar
tinker
Regular Visitor
7 years ago

DAX IF measure - return fixed value

This should be a very simple requirement. But it seems impossible to implement in DAX.

 

Data model, User lookup table joined to many "Cards" linked to each user.

I have a measure setup to count rows in CardUser. That is working fine.

<measureA> = count rows in CardUser

 

I want to create a new measure,

<measureB> = IF(User.boolean = 1,<measureA>, 16)

If User.boolean = 1, I want to return a fixed value of 16. Effectively, bypassing measureA.

I can't simply put User.boolean = 1 in the IF condition, throws an error.

 

 

I can modify measureA itself to return 0 if User.boolean = 1

measureA> =
CALCULATE (
 COUNTROWS(CardUser),
 FILTER ( User.boolean != 1 )
)
 
This works, but I still can't find a way to return 16 ONLY if User.boolean = 1.

 

Zubair_Muhammad, appreciate if you can take a look at this. :)

2 Replies