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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
thebrinery
Frequent Visitor

comparing sales averages with multiple filters

Hi all,

 

Looking to compare the sales of two products. I want to be able to compare the total and average unit sales for stores that sell Product A only, stores that sell Product B only, and stores that sell both Product A and B. I am stuck determining the best custom measure that can filter for both the store and the product. Any insight?

 

I also wanted to see the distinct count of stores that sell each product and successfully wrote a customer measure for stores that sell Product A only and Product B only, but the function did not work when I tried to filter for both in one measure:

"Count of A & B Stores = CALCULATE(DISTINCTCOUNT('Portal Data'[Store]),FILTER('Portal Data',[Description]="SAUERKRAUT A" && [Description]="SAUERKRAUT B"))

How did I go wrong here? The card read the measure as Blank.

 

Thanks for helping us become Power BI Wizards!

1 ACCEPTED SOLUTION
v-yuezhe-msft
Employee
Employee

@thebrinery,

I make a test using the following sample data, and create the measures below.
1.JPG

Count of A&B stores = CALCULATE(DISTINCTCOUNT('Portal Data'[Store]),FILTER('Portal Data','Portal Data'[Description]="SAUERKRAUT A" || 'Portal Data'[Description]="SAUERKRAUT B"))

total sales = CALCULATE(SUM('Portal Data'[Sales]),FILTER('Portal Data','Portal Data'[Description]="SAUERKRAUT A" || 'Portal Data'[Description]="SAUERKRAUT B"))

average sales = [total sales]/[Count of A&B stores]

If the above DAX don’t help, please share sample data of your  table and post expected result here. Do mask sensitive data before you uploading sample data.


Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-yuezhe-msft
Employee
Employee

@thebrinery,

I make a test using the following sample data, and create the measures below.
1.JPG

Count of A&B stores = CALCULATE(DISTINCTCOUNT('Portal Data'[Store]),FILTER('Portal Data','Portal Data'[Description]="SAUERKRAUT A" || 'Portal Data'[Description]="SAUERKRAUT B"))

total sales = CALCULATE(SUM('Portal Data'[Sales]),FILTER('Portal Data','Portal Data'[Description]="SAUERKRAUT A" || 'Portal Data'[Description]="SAUERKRAUT B"))

average sales = [total sales]/[Count of A&B stores]

If the above DAX don’t help, please share sample data of your  table and post expected result here. Do mask sensitive data before you uploading sample data.


Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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