Skip to main content
cancel
Showing results for 
Search instead 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.

Reply
ChrisMed
New Member

Switch works in power pivot but not in Power Bi

Hello,

Looking for a solution for this.

I made my model in Power pivot, then loaded it into PBI.

In Excel, my switch measure works fine, and the measures in the switch funtion appear in the pivot table in the appropriate places.

In PBI, when I select a matrix to diplay the data, all the data appears correctly, apart from the some of rows that are concernd by the switch function, these appear blank(in red in the below measure)

The measures not appearing in the matrix are all division( Divide)

If I put the measures concerned by the switch in a Card, they work fine.

 

Here is the measure

Reprev = CALCULATE(SWITCH(MAX(TABLIBHYPFINAL[LIBELLE N°]);126;[Effectif Present];127;[Ca Net/Effectif];128;[Stocks];129;[Clients];130;[Fournisseurs];131;[BFR];132;[MS/VA];133;[PDM];138;[Heures MO];[Montant New Sum]);AUTO_DOM_HR[SCENARIO]="Forecast")

 

Any ideas?

Thanks.

 

1 REPLY 1
v-shex-msft
Community Support
Community Support

Hi @ChrisMed,

 

Maybe you can try to define a variable to store switch condition, then direct use that variable in calculate:

 

Reprev =
VAR switchMeasrue =
    SWITCH (
        MAX ( TABLIBHYPFINAL[LIBELLE N°] );
        126; [Effectif Present];
        127; [Ca Net/Effectif];
        128; [Stocks];
        129; [Clients];
        130; [Fournisseurs];
        131; [BFR];
        132; [MS/VA];
        133; [PDM];
        138; [Heures MO];
        [Montant New Sum]
    )
RETURN
    CALCULATE ( switchMeasrue; AUTO_DOM_HR[SCENARIO] = "Forecast" )

 

If above not help,  can you please share some sample data for test?

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

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

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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