cancel
Showing results for
Did you mean:

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Frequent Visitor

## DAX Measure Base on Column value

Hi All

I will appreciate your help as I'm trying to figure out my roadblock  in power bi, here is the scenario

I'm trying to create a measure base on the value on the field, the table have already  3 measures but I want to create a 4th but the formula is different based on the column value.

I'm trying to invoke the if but it didn't detect the field name since its a calculated measure.

 Product Measure 1 Measure 2 Measure 3 Measure 4 A 100 150 300 if Product = A then Measure 1 + Measure 3                  else measure 1 + Measure 2 + Measure 3 B 100 150 300 if Product = A then Measure 1 + Measure 3                  else measure 1 + Measure 2 + Measure 4 C 100 150 300 if Product = A then Measure 1 + Measure 3                  else measure 1 + Measure 2 + Measure 5

Thank you

2 ACCEPTED SOLUTIONS
Super User

@DemiHaung

you can't pick the column name directly in a measure so this is the approach! Share your Kudos

MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!

Frequent Visitor

Hi DemiHaung, Try this

Measure 4 =
VAR SelectedProduct = SELECTEDVALUE(Table[Product])
RETURN
IF(
SelectedProduct = "A", [Measure1]+[Measure2]+[Measure3],
BLANK()
)

If found helpful mark as a solution or give Kudos for efforts. Thanks!

3 REPLIES 3
Frequent Visitor

Hi DemiHaung, Try this

Measure 4 =
VAR SelectedProduct = SELECTEDVALUE(Table[Product])
RETURN
IF(
SelectedProduct = "A", [Measure1]+[Measure2]+[Measure3],
BLANK()
)

If found helpful mark as a solution or give Kudos for efforts. Thanks!

Frequent Visitor

thank you it works, I never thought I can use the selectedvalue this way.

Super User

@DemiHaung

you can't pick the column name directly in a measure so this is the approach! Share your Kudos

MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!

Announcements

#### Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

#### Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

#### Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors