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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
ovetteabejuela
Impactful Individual
Impactful Individual

Nested If | Measures as Rows

This is working for me:

 

Values (Home) = IF(NOT(ISBLANK([A Measure])) && HASONEVALUE('Home'[Measures]),
SWITCH (
LASTNONBLANK ( 'Home'[Measures], 1 ),
"Metric Name 1", [Measure Calc 1],
"Metric Name 2", [Measure Calc 2],
"Metric Name 3", [Measure Calc 3],
"Metric Name 4", [Measure Calc 4],
))

 

EDIT: I am not sure if I'm asking the right questions but based above is there anyway I could check the value of another filter and toggle Metric Name 3 to show/hide?

 

However I wanted more, the situation... There is one metric in there say "Metric Name 3" that should only appear based on another filter, lets name that filter as TableX[Toggle Show Metric Name 3], so I was wondering if I can do something like this

 

 

Values (Home) = IF(NOT(ISBLANK([A Measure])) && HASONEVALUE('Home'[Measures]),
SWITCH (
     LASTNONBLANK ( 'Home'[Measures], 1 ),
          "Metric Name 1", [Measure Calc 1],
          "Metric Name 2", [Measure Calc 2],
IF(HASONEVALUE(tableX[Toggle Show metric 3]) "Metric Name 3", [Measure Calc 3],
) "Metric Name 4", [Measure Calc 4], ))

 

Is this even possible, if not would you have a suggestion?

 

 

EDIT: Not usre if I'm asking the right question, let me rephrase... bsaed on the scenario above is there a way to check the value of another filter and based on what's selected toggle Metric Name 3 to show/hide? 

3 REPLIES 3
v-ljerr-msft
Microsoft Employee
Microsoft Employee

Hi @ovetteabejuela,

 

Have you tried the solution provided above? Does it work in your scenario? 

 

If you still have any question on this issue, feel free to post here. Smiley Happy

 

Regards

v-ljerr-msft
Microsoft Employee
Microsoft Employee

Hi @ovetteabejuela,

 

If I understand you correctly, instead of adding the logic within the SWITCH function, you should rewrite [Measure Calc 3] or just create a new measure for "Metric Name 3" to add this new logic for toggling Metric Name 3 to show/hide with another filterSmiley Happy

 

New Measure Calc 3 = IF ( HASONEVALUE ( tableX[Toggle Show metric 3] ), [Measure Calc 3], BLANK () )
Values (Home) = IF(NOT(ISBLANK([A Measure])) && HASONEVALUE('Home'[Measures]),
SWITCH (
LASTNONBLANK ( 'Home'[Measures], 1 ),
"Metric Name 1", [Measure Calc 1],
"Metric Name 2", [Measure Calc 2],
"Metric Name 3", [New Measure Calc 3],
"Metric Name 4", [Measure Calc 4],
))

 

Regards

bblais
Resolver III
Resolver III

Can you move the IF into the expression of the SWITCH instead?

 

Values (Home) = IF(NOT(ISBLANK([A Measure])) && HASONEVALUE('Home'[Measures]),
SWITCH (
        IF(HASONEVALUE(tableX[Toggle Show metric 3]),
           "Metric Name 3",
LASTNONBLANK ( 'Home'[Measures], 1 )
), "Metric Name 1", [Measure Calc 1], "Metric Name 2", [Measure Calc 2], "Metric Name 3", [Measure Calc 3], "Metric Name 4", [Measure Calc 4], ))

 

 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.