Forum Discussion

abhifx's avatar
abhifx
Frequent Visitor
2 years ago

Unable to Replace Column data in Matrix Using Switch

Dear All

 

I have been trying to replicate the revenue statement in Power BI directly linked with a trial balance. However once i insert a format and link multi level data into Power BI, I am unable to replace blank cells with specific data calculated with a measure.

 

here is the rundown of structure

1) a Sample format data with a column to sort and a column to link with master data

2) master data to link trial with sample format

3) trial balance

 

Now I need to calculate Total Sale and bunch of other blanks (i have removed subtotal for obvious reasons) and then insert in the Matrix

However, Unable to get this done

 

 

 

 

Switch data = 

SWITCH(
    SELECTEDVALUE('MIS Format'[Line Item Desc]),"Total Sale",[Total Sales]
    ,[PL Amount]
)

 

 

 

Any help would be appreciatedplace to replace

 Any help is appreciated. There is even more issues but this breakthrough would be enough to have a start.

 

Thanks in advance

Link to Power Bi File

https://drive.google.com/file/d/185GF_modCuqKrP0RNCdfT34kjlxAwlAz/view?usp=drive_link

10 Replies

  • Hi abhifx

    Have you tried checking whether it is really Total Sale or maybe there spaces before or after or there are more than one spaces between Total and Sale?
    You can upload your pbix to Google or One Drive and share a public link.

  • abhifx's avatar
    abhifx
    Frequent Visitor

    Hi amitchandak, was trying to follow your tutorial online however not able to achieve the same result. If you may help in this regard? 

  • abhifx's avatar
    abhifx
    Frequent Visitor

    hi danextian , sorry for delayed reply. Getting in to quarterly review meetings.

     

    So about the switch function, i am now able to get sub totals as per desired format, however, when the report is drilled down then total is lost. how to fix that?

     

    below the witch function

    Switch Subtotal = 
    
    SWITCH(
        SELECTEDVALUE('MIS Format'[Line Item Desc]),
        "Total Sale",[Total Sales], 
        "Total Variable Cost",[Total Variable Cost],
        "Total COGS Without VC",[Total COGS Without VC],
        "Total COGS", [Total COGS],
        "Gross Profit",[Gross Profit],
        [Total Trial]
    
    )