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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
wenchi
Helper I
Helper I

dax help for like-for-like sales comparison

Hi all,

 

I need to create some dax measures to do like-for-like store sales performace comparison. Let me explain by example. We often need to compare a chain store performace, like walmart, against all stores (non-walmart stores) with the matching 5-digit zipcode. We name this "trade area" (TA) measures. We need to compare the sales quantity and store count between the selected chain and TA for any possible time frame (filter) in the report. To make it even worse, the TA definiton needs to only include chain stores zipcode which total store sales quantity >0 for selected time period. For store count, we need to apply the same TA definition for store total quantity > 0. The fact table store store quanity by product sku, week date, suppliers, etc..

Since the TA definition is dynamic based on chain selection and store total quantity for a selected period, so I can't create a static table to store TA data, instead, i have to create dax mesures for TA quanity and TA store count. I was able to do so and the performance is not that great since i have to apply the same rule for finding all qualified TA stores for each measure. I wonder if there is any way to define to TA data only once, then i can calculate the quantity and store count based on that TA data?

 

Thanks in advance.

Wenchi Wang

10 REPLIES 10
wenchi
Helper I
Helper I

Well, I am afraid your suggested method might not work in our real dataset. The sample file that I provided is a very simple dataset. In reality, we have 117 weeks of data in fact table and about 1 billion rows of data. I am just curious if I can get the list of zipcode for trade area once to serve for both store count and total vol measures. My current measure is doing repeatedly in each measure to get a list of zip codes that makes up the trade area.

 

Wenchi

how many chains do you need to compare from? You can precompute the zip code mappings for each chain.

we have about 2000+ chains and 400,000+ stores that need to have these measures for reporting. The user can pick any chain or any independent stores on the report, not mentioned that they can change time periods or apply any additional filters on the fly,

That's a nice challenge.  I hope you have a P4 SKU or better.

we currently create olap cube running on azure ssas. I am thinink about to migrate to fabric without using ssas. No matter what, it's not that fast. If i try to list some large chain to display, i might use all the resources...

 

 I am thinink about to migrate to fabric without using ssas

Good one.  Remember that Power BI is SSAS Tabular, and Fabric is very similar (Delta Lake)

wenchi
Helper I
Helper I

here is my sample data file with some explaination and PBI file.

Excel file - Excel File 

PBI Report - PBI 

I would approach the topic a little differently.

lbendlin_0-1733867508206.png

 

 

wenchi
Helper I
Helper I

i have my files ready, can i get your email so i can share the file with you?

lbendlin
Super User
Super User

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Please show the expected outcome based on the sample data you provided.

Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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