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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
PBInterest
Frequent Visitor

Nested filters for case like statement

I have two lines of business and I want to summarize values over the combined lines of business. This data lives in the same table but some attributes only apply to one or the other business line. Both lines of business share some common rules which I filter on using calculate in a measure. One of the business lines has a filter unique to it. I am trying to figure out the best way to write a measure that first uses the common filters, but for one line of business add a second filter that won't filter out the rest of the totals for the other business line.

 

The current measure incorporates only the common filters:

 

What I have:

TotalSales:=CALCULATE ( SUM(SalesTotal), CommonFilterA= 1, CommonFilterB = 2)

 

What I need to add:

<Filter Condition> When BusinessLineId = 2 then SUM(TotalSales) where the SalesType = Retail.

 

I need to add a filter that applies to only one of the two business lines. I need to be able to summarize SalesTotals for both lines of business. I was hoping there was a way I could do this without creating two measures, one for each business line, and then summarizing both. Is there a way to write this in a single DAX statement?

 

Thanks.

 

 

1 REPLY 1
amitchandak
Super User
Super User

@PBInterest , based on what I got

 

calculate([TotalSales],filter(Table, [BusinessLineId] <> 2)) + calculate([TotalSales],filter(Table, [BusinessLineId] = 2 && [SalesType] = "Retail" ))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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