cancel
Showing results for 
Search instead for 
Did you mean: 
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 IV
Super User IV

@PBInterest , based on what I got

 

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



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

July 2021 Update 768x460.png

Check it out!

Click here to read more about the July 2021 Updates