Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

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?

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

Power Bi File 

  • kentyler's avatar
    kentyler
    6 years ago

    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.

     

     

6 Replies

  • kentyler's avatar
    kentyler
    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

    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/

    • Anonymous's avatar
      Anonymous
      Not applicable

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

      • kentyler's avatar
        kentyler
        Solution Sage

        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.

         

         

  • 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:

    • Anonymous's avatar
      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