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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

DAX measure to sum sales for store numbers that are common/same across 3 months

I have a large table that contains sales $s by store number on a daily basis (1 row per store per day).  I'm trying to create a measure that will compare the total sales for each store against the average of the two prior months - however, I only want the measure/sum to include store numbers that are present in each of the 3 months (current month & two prior months being used for the baseline).

 

So - Jan total $s sold total will be compared to average of Nov & Dec $s total - but only store numbers that are present in the sales data in Nov, Dec & Jan should be included in the totals... 

 

Thank you in advance!

3 REPLIES 3
MFelix
Super User
Super User

Hi @Anonymous ,

 

Can you please share a mockup data or sample of your PBIX file. You can use a onedrive, google drive, we transfer or similar link to upload your files.

If the information is sensitive please share it trough private message.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Anonymous
Not applicable

Hi Miguel,

 

The part I'm struggling with is how to identify the common stores across the 3 month range - lets say I have something like this (I'm able to do a distinct for each month to get the strings/values):

Jan = {"A", "B", "C", "D"}

Feb = {"B", "C", "D"}

Mar = {"C", "D", "F", "G"}

 

How can I write DAX to get the answer: 

Common = {"C", "D"}

 

Result should be an array as there will likely be hundreds of values/store codes that I will then use as a filter to get the sales for those stores.

 

Thanks!

Hi @Anonymous ,

 

Depending on the way you have the model. Do you have any calendar table?

 

Asking this because you need to make an intersect between the 3 months values, but to do the filter of the 3 months, But depending on how you have the model there may need to be some adjustments made.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
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.