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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
nicolast29
Helper V
Helper V

Why is my switch not <orking

Hi

I have a switch who show Dax formula in case of a match with my matrix column name:

Switch CA = 
SWITCH(true(),
SELECTEDVALUE(Matrice[Titre])="Epicerie",CAHebdo[CA Epicerie],
SELECTEDVALUE(Matrice[Titre])="Liquide",CAHebdo[CA Liquide],
SELECTEDVALUE(Matrice[Titre])="Entretien",CAHebdo[CA Entretien],
SELECTEDVALUE(Matrice[Titre])="Beauté",CAHebdo[CA Beaute] ,
SELECTEDVALUE(Matrice[Titre])="DPH",CAHebdo[CA DPH]
)

All work except the last one who is a total of the other :

CA Epicerie = 
Var Section = 6
Return
CALCULATE(SUM(CAHebdo[CA]),CAHebdo[SectionAbaco]=Section)
CA DPH = CAHebdo[CA Beaute]+CAHebdo[CA Entretien]

 

I try to understand why, but i didn(t understand

https://1drv.ms/u/s!AoqtZHsX4BzvhI9pGmF1KVaJ8wwljQ?e=knTvkk

 

Thanks for helping

1 ACCEPTED SOLUTION
mangaus1111
Solution Sage
Solution Sage

Hi @nicolast29 ,

in my opinion the measure Switch works only if you create a calculated table filtered for the codes 8 and 9, because the relationship 1 to many between tables 'Matrice' and 'CAHebdo' allows no calculation for the item DPH (DPH is code 10 and code 10 does not exist in the fact table).

 

Anyway you can find my solution here in the link.

https://1drv.ms/u/s!Aj45jbu0mDVJi15CYVnv2JZWf3iV?e=Pmw7FG

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

2 REPLIES 2
mangaus1111
Solution Sage
Solution Sage

Hi @nicolast29 ,

in my opinion the measure Switch works only if you create a calculated table filtered for the codes 8 and 9, because the relationship 1 to many between tables 'Matrice' and 'CAHebdo' allows no calculation for the item DPH (DPH is code 10 and code 10 does not exist in the fact table).

 

Anyway you can find my solution here in the link.

https://1drv.ms/u/s!Aj45jbu0mDVJi15CYVnv2JZWf3iV?e=Pmw7FG

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Hi

Thanks now i understand my mistake

Have a nice day

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.