cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
karimkz Regular Visitor
Regular Visitor

IF statement in Measure, need help

Hi,

 

I want my Measure to change value, based on a selected Unit.

Just like that: 

q1.PNGq2.PNG

 

So how do I write something like: 

          IF (car_id=0109) then Measure=22  (doesn't work this way) 

Or: 

          IF (selected(0109) then Measure=22; 

 

 In DAX actually. Thanks for help, I appreciate!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Moderator v-sihou-msft
Moderator

Re: IF statement in Measure, need help

@karimkz

 

In DAX, Measure is always sliced by current row context, it's not possible to use the current slicing row as condition in Measure. In your scenario, you can create a dummy measure for this conditon. Just create a measure like:

 

Dummy = SUM(Table[car_id])

 

 

Then you can create a calculated measure like:

 

Measure =IF([Dummy]=112,22,[Measure_Gauge])

 

 

Regards,

View solution in original post

1 REPLY 1
Highlighted
Moderator v-sihou-msft
Moderator

Re: IF statement in Measure, need help

@karimkz

 

In DAX, Measure is always sliced by current row context, it's not possible to use the current slicing row as condition in Measure. In your scenario, you can create a dummy measure for this conditon. Just create a measure like:

 

Dummy = SUM(Table[car_id])

 

 

Then you can create a calculated measure like:

 

Measure =IF([Dummy]=112,22,[Measure_Gauge])

 

 

Regards,

View solution in original post

Helpful resources

Announcements
New Kudos Received Badges Coming

New Kudos Received Badges Coming

Kudos to you if you earned one of these! Check your inbox for a notification.

Microsoft Implementation for Communities Wins Award

Microsoft Implementation for Communities Wins Award

Learn about the award-winning innovation that was implemented across Microsoft’s Business Applications Communities.

Power Platform World Tour

Power Platform World Tour

Find out where you can attend!

Top Kudoed Authors (Last 30 Days)
Users online (1,568)