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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Claudio7
Regular Visitor

Problems with SWITCH(TRUE() Function

Hello. I need some help with the SWITCH(TRUE() function. 

I'm trying to build a report with the P&L of few different entities. I use a simple P&L Templates where main lines are marked as "0" in column "Subtotals" and subtotal lines are marked as "1". 

Claudio7_0-1689853427612.png

 

I made a table "P&L Amounts with columns: Company code, P&L Items, Month, Actual amount".

Claudio7_1-1689853525169.png

 

Using the a DAX measure like this:

SWITCH(TRUE(),
SELECTEDVALUE(PL_Template[Subtotal])=0, [P&L Actual Amounts],
SELECTEDVALUE(PL_Template[Subtotal])=1, [P&L Subtotals],BLANK())

I can get a table where the P&L works only considering consolidate datas, but it doesn't work when I want to see (trough a slicer or a filter, a single entity P&L and also if I add the period/month (I get only the P&L amounts without subtotals).  

Claudio7_0-1689846180637.png

Is it possible to use this function next to a FILTER() or similar? 

 

Thanks a lot for your help!

 

3 REPLIES 3
technolog
Super User
Super User

I hope this message finds you well. I've noticed that this solution remain unresolved. If any of you have managed to find a resolution to the issue, I kindly request that you share your solution for the benefit of the entire community. Alternatively, if you're still facing challenges, please do let us know as well.

Your insights and updates will greatly assist others who might be encountering the same challenge.

mlsx4
Memorable Member
Memorable Member

Hi @Claudio7 

 

I can't really understand what are you trying to obtain. Can you share an example?

Hello ! Thanks for your reply. I actually wanted to have a full income statement by company code. I worked on the report from the time being and I changed it, replacing the dax codes above with calculated tables. I notice that the issue I have is with the relations between 3 tables when looking up at the company codes, as I don't manage to have the relation active for all these tables. I guess I will have to open a new thread for this. Thanks!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.