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
Anonymous
Not applicable

Switch function from two seperate tables???

Hi Experts

 

Is it possible to askthe swtich function to look at two seperate tables and apply the correct measures depending on what filter is selected...so i currently have..

MeasureName2 = IF(ISCROSSFILTERED(ProfitabilityMeasures[MeasureName]),SWITCH(TRUE(),
        VALUES(ProfitabilityMeasures[MeasureName]) = "Net Sales", [Net Sales @AOP BM %],
        VALUES(ProfitabilityMeasures[MeasureName]) = "Gross Margin", [Total Margin %],
 VALUES(ProfitabilityMeasures2[MeasureName2]) = "Apples", [Total Margin Net],
 VALUES(ProfitabilityMeasures2[MeasureName2]) = "banana", [Total Margin LY],
BLANK()),BLANK())   
1 ACCEPTED SOLUTION

switch with 2 tables.PNGI try it, and it could work technical.

under here my test in picture. 

 

there are only a few but. the swicht goes from bottom to top. 

if the first is true. like legend is proposta2. than it does not mather if the catory is also true, it only shows the first measure. 

wich makes sens to me.

the final row in my table does no have a defined leged than i looks for the category.

 

gives this a idea of what you could do?

 

switch = 
VAR Legend = SELECTEDVALUE(Table1[Column1])
VAR Category = SELECTEDVALUE(ProductCategory[Name])
RETURN 
SWITCH(TRUE();
    Legend = "Proposta2"; [Measure 2] ;
    Legend = "Proposta3"; [Measure 3];
    Category = "Bikes"; [Measure 4];
    Category = "Clothing"; [Measure 5];
BLANK())

switch with 2 tables.PNG

 

 

View solution in original post

6 REPLIES 6
Baskar
Resident Rockstar
Resident Rockstar

@Anonymous

 

Create all the measures Names  in one table (ProfitabilityMeasures[MeasureName]) 

like this 

 

MeasureName

 

Net Sales
Gross Margin
Apples
banana

 


and try this below measure Net SalesGross MarginApplesbanana

 

MeasureName2 = SWITCH(CONCATENATEX(VALUES(ProfitabilityMeasures[MeasureName]),ProfitabilityMeasures[MeasureName],","),
"Net Sales", [Net Sales @AOP BM %],
"Gross Margin", [Total Margin %],
"Apples", [Total Margin Net],
"banana", [Total Margin LY],
BLANK())

Anonymous
Not applicable

All Thanks...

 

But two tables is also possible???? - i understand the one table solution.

Maddy99
Resolver II
Resolver II

yes it can. i build 1 swicht depand on a filter like yours and on the format filter.

 

but i dont quite understand what you want.do you have an chart example of your result?

you have 4 measure and you want to show 1 measure as correct depands on the filter?

 

mvg,

madelon

Anonymous
Not applicable

Hi thanks for the feedback...

 

tables i has the gross margine and net sales, table 2 has the apples and banana, i have two filters... if i select say for instant apples then return back measure 3....

 

 

switch with 2 tables.PNGI try it, and it could work technical.

under here my test in picture. 

 

there are only a few but. the swicht goes from bottom to top. 

if the first is true. like legend is proposta2. than it does not mather if the catory is also true, it only shows the first measure. 

wich makes sens to me.

the final row in my table does no have a defined leged than i looks for the category.

 

gives this a idea of what you could do?

 

switch = 
VAR Legend = SELECTEDVALUE(Table1[Column1])
VAR Category = SELECTEDVALUE(ProductCategory[Name])
RETURN 
SWITCH(TRUE();
    Legend = "Proposta2"; [Measure 2] ;
    Legend = "Proposta3"; [Measure 3];
    Category = "Bikes"; [Measure 4];
    Category = "Clothing"; [Measure 5];
BLANK())

switch with 2 tables.PNG

 

 

Anonymous
Not applicable

Hi

 

I cannot get this measure to work it works for the first VAR only...

ProfitabilityMeasureSwitch = 
VAR ProfitbabilityMeasure = SELECTEDVALUE(ProfitabilityMeasures[MeasureName])
VAR ReportingMeasure = SELECTEDVALUE(Reporting[Reporting])
RETURN 

SWITCH(TRUE(),
    ProfitbabilityMeasure = "Gross Margin", [Total Margin %] ,
    ProfitbabilityMeasure = "Net Sales", [Net Sales @AOP BM %],
    ReportingMeasure = "NOE", [YoY NOE Variance],
    ReportingMeasure = "Reported", [YoY Reported Variance],
BLANK())

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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