Forum Discussion

quickbi's avatar
quickbi
Helper II
2 years ago
Solved

Error SelectedValue

Hi All,

 

I'm making a P&L statement and I'm using a PL mapping section:

When I create a Pivot in PBI I assign the fields as:

Where selectedvaluetest show for each row what row is calculating. But I have a problem with this DAX:

 

PL Amount test = 
IF(
    SELECTEDVALUE('PL Accounts'[Level1]) = "Margin",
    CALCULATE([PL Amount Net Revenues] + [PL Amount Gross Margin]),
    SWITCH(
        TRUE(),
        SELECTEDVALUE('PL Accounts'[Level1order]) = 10, [PL Amount Net Revenues],
        SELECTEDVALUE('PL Accounts'[Level1]) = "Gross Margin", [PL Amount Gross Margin],
        SELECTEDVALUE('PL Accounts'[Level1]) = "EBITDA 4WALL", [PL Amount EBITDA 4 WALL],
        SELECTEDVALUE('PL Accounts'[Level1]) = "EBITDA", [PL Amount EBITDA],
        SELECTEDVALUE('PL Accounts'[Level1]) = "EBIT", [PL Amount EBIT],
        SELECTEDVALUE('PL Accounts'[Level1]) = "EBT", [PL Amount EBT],
        0
    )
)

Because Margin line did not appear as SelectedValuetest  value, anyone knows why?

 

thanks all for your help

 

 

 

  • quickbi ok, my next hypothesis is that there are some null or blank values getting in the way. Can you try changing your selectedvalue test to use

     

    CONCATENATEX( VALUES(tablename[Level1]), tablename[Level1], ", " )

3 Replies

  • AllisonKennedy's avatar
    AllisonKennedy
    Community Champion

    You may need to add some filter modifiers to your calculate and/or selectedvalue. You can see the selectedvalue test is blank for the top row for each level 1 account in your visual, and because Margin is collapsed the top row is the only one that exists. 

    • quickbi's avatar
      quickbi
      Helper II

      Hi AllisonKennedy 
      thanks for your answer but is not the problem because all level1 are showing if they are or aren't collapsed.
      ...and I expanded all Margin level but did not show anyvalue

       

       

      • AllisonKennedy's avatar
        AllisonKennedy
        Community Champion

        quickbi ok, my next hypothesis is that there are some null or blank values getting in the way. Can you try changing your selectedvalue test to use

         

        CONCATENATEX( VALUES(tablename[Level1]), tablename[Level1], ", " )