Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
karimkz
Advocate I
Advocate I

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
v-sihou-msft
Microsoft Employee
Microsoft Employee

@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

2 REPLIES 2
Anonymous
Not applicable

Hi Team

 

i need some assistance with converting this to a measure

if[AffiliateOwnerID]=3 and [ActivityTypeID]=1 or[ActivityTypeID]=2 then 2
else if [AffiliateOwnerID]=3 and [ActivityTypeID]=41 then 10
else if [AffiliateOwnerID]=3 and [ActivityTypeID]=6 or [ActivityTypeID]=42 then 5
else if [AffiliateOwnerID]=3 and [ActivityTypeID]=43 then 12
else 0

 

will really appreciate your assistance

v-sihou-msft
Microsoft Employee
Microsoft Employee

@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,

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors