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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Problem with Switch and Selected Value Function

Hi guys, I had trouble building this Visualization.

Whenever I put it inside a Switch function, it always returns Null. I think it has something to do with the Row Filter context.

Like in the picture, the measure for TAX and PAT return Null, therefore it is hidden?

test.png

Here is the Power BI file. Any help is appreciated.

Power Bi File 

1 ACCEPTED SOLUTION

You have 2 possiblities. Talk to the people who are doing the extract and ask them to provide you with an un-pivoted set of data, or use power query inside power bi to unpivot the data before you start analyzing it.

 

 





Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


View solution in original post

6 REPLIES 6
jdbuchanan71
Super User
Super User

Hello @Anonymous 

The measure you are using in the switch return no value for those lines so they don't show up in the visual:

MissingMeasure.jpg

Anonymous
Not applicable

@jdbuchanan71 I used it inside the Result measure. You can check for it buddy, if everything goes right, it should appear on line 2 and 4

kentyler
Solution Sage
Solution Sage

It might help generally, with all your visualzations and dax measures, to unpivot your data before you start

StatementAccountOrder 
L114. Profit before tax1
L115. CIT2
L116. Deferred tax3
L117. Profit after tax4
L117. Profit after tax4
L214. Profit before tax1
L215. CIT2
L216. Deferred tax3
L217. Profit after tax4
L2% Profit5

Your data looks like it might be coming from a report in excel. Manipulating data where you have it laid out like a pivot table can introduce some weird kinks.
I loaded this table into your test file and just added some fields to a pivot table

new_data.png

I did not try to replicate your calculations, this was just an example to show how the results "fall out" alot easier if the data is in a form that Power Bi "likes"
This is an example of applying Slogan 1 of the 7 Slogans for working with Power BI. You can find more details here https://bislogans.com/3-shape-your-business-data-before-you-load-it-into-power-bi/





Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


Anonymous
Not applicable

Hi @kel thanks for the help, the report is extracted from a bigger model from SQL Database table

You have 2 possiblities. Talk to the people who are doing the extract and ask them to provide you with an un-pivoted set of data, or use power query inside power bi to unpivot the data before you start analyzing it.

 

 





Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


just to make things cliear, here is the dummy table i built to represent the un-povited data

StatementAccountResultOrder 
L114. Profit before tax671
L115. CIT82
L116. Deferred tax893
L117. Profit after tax554
L117. Profit after tax444
L214. Profit before tax91
L215. CIT3442
L216. Deferred tax63
L217. Profit after tax444
L2% Profit6665




Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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
Top Kudoed Authors