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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
sportive92003
Helper II
Helper II

Switch category

Hello,

I have one client X who is in the sector "20%...". I have to eliminate this category and put 33% of the amount in sector "01-..."; 33% in sector "02-..." and 33% in sector "07-...". On the graphic, if I select client X, I want to see the amount divided in these 3 sectors. If I select sector "01-Machinerie", or 02 or 07 the 33% of this client mus be included in each. I have 7 sectors in total, must have 6. Any idea?

Thanks!

sportive92003_0-1721758762339.png

 

8 REPLIES 8
BeaBF
Super User
Super User

@sportive92003 you need to create a column to switch the category, can you share the file pbix o paste sample data?

 

BBF

Hello BeaBF,

yes, here are the datas. I don't see join a piece, sorry. I don't have sector 7 in this example so just use sector 4 instead (so 33% in sector 1, 33% sector 2 and 33% sector 4)

 

Secteur Somme de montant
01 -Machinerie et travaux9 462 578,60 $
02 -Marine et portuaire 2 075 130,21 $
03 -Hydroélectrique 1 496 395,65 $
20% MARINE 1 405 415,56 $
04 -Minier 998 681,01 $
08 -Autres 462 184,81 $
10 - Equipement golf 75 892,44 $

 

Anonymous
Not applicable

Hi  @sportive92003 ,

@BeaBF  , thanks for your concern about this case. 

 

Based on your description, I added a client column:

 

 vlinhuizhmsft_5-1721822138118.png

 

Here's the original pie chart:

 

 vlinhuizhmsft_6-1721822157892.png

 

Please follow these steps:

 

1.Create a measure and filter the sector:

 

Measure = IF(SELECTEDVALUE('Table'[sector])="20% MARINE, 20% HYDRO",1,0 )

 

 vlinhuizhmsft_7-1721822157892.png

 

2.Create a calculated column:

 

Column = 
 var A=CALCULATE(SUM('Table'[amount]),FILTER('Table','Table'[sector]="20% MARINE, 20% HYDRO"))
 RETURN
IF(LEFT('Table'[sector],2) in {"01","02"},CALCULATE(SUM('Table'[amount])+A*1/3,ALLEXCEPT('Table','Table'[sector])),CALCULATE(SUM('Table'[amount]),ALLEXCEPT('Table','Table'[sector])))/2

 

3.The final result is as follows:

 

 vlinhuizhmsft_8-1721822207276.png

Best Regards,
Zhu
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

 

 

 

 

Hello dear, thanks for your help, I progress well! I'm near from the solution. I have added the amount of sector 1,2 and 3 to the 1/3 of amount of sector 20%. Now I just need to show the VAR A_BNAC; B_BNAC and C_BNAC and the rest of the others sectors (normal amount). What would be the next step afetr RETURN?

 

Secteur_BNAC =
VAR A = CALCULATE([Montant Measure],Fusionner1[Clients.Secteur ] = "01 -Machinerie et travaux")
VAR B = CALCULATE([Montant Measure],Fusionner1[Clients.Secteur ] = "02 -Marine et portuaire")
VAR C = CALCULATE([Montant Measure],Fusionner1[Clients.Secteur ] = "03 -Hydroélectrique")
VAR Montant_BNAC = IF('Fusionner1'[Secteur 20%] = 1, 'Fusionner1'[montant] / 3, BLANK() )
VAR A_BNAC = (A+Montant_BNAC)
VAR B_BNAC = (B+Montant_BNAC)
VAR C_BNAC = (C+Montant_BNAC)
RETURN

@sportive92003 here:

Secteur_BNAC =

VAR A = CALCULATE([Montant Measure], Fusionner1[Clients.Secteur] = "01 -Machinerie et travaux")

VAR B = CALCULATE([Montant Measure], Fusionner1[Clients.Secteur] = "02 -Marine et portuaire")

VAR C = CALCULATE([Montant Measure], Fusionner1[Clients.Secteur] = "03 -Hydroélectrique")

VAR Montant_BNAC = IF(Fusionner1[Secteur 20%] = 1, Fusionner1[montant] / 3, BLANK())

VAR A_BNAC = (A + Montant_BNAC)

VAR B_BNAC = (B + Montant_BNAC)

VAR C_BNAC = (C + Montant_BNAC)

RETURN

    SWITCH(

        TRUE,

        Fusionner1[Clients.Secteur] = "01 -Machinerie et travaux", A_BNAC,

        Fusionner1[Clients.Secteur] = "02 -Marine et portuaire", B_BNAC,

        Fusionner1[Clients.Secteur] = "03 -Hydroélectrique", C_BNAC,

        Fusionner1[Secteur 20%] = 1, Montant_BNAC,

        Fusionner1[montant])

 

BBF

Hello again, it's ok when using de RETURN A_BNAC, but adding the switch it come back to the original version. Selecting sector 01, it should appears sector 01 and sector 20% (1/3) like that. In the programmation something is wrong with the switch. Do you have any other solution?

sportive92003_1-1721918479929.png

 

Hello,

I'm sorry, the result is same as usual.

Result sector 01 should be 9 931 050 (sector 01= 9 462 578 + 1/3 of sector 20% (468 471)

sportive92003_0-1721914176374.png

 

Hello,

See results for my client X (name is BNAC). I should see the 3 sectors but nothing appears 

 

sportive92003_0-1721825746634.png

 

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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