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
anandav
Skilled Sharer
Skilled Sharer

Calculating member sales - using Fact vs Dim DAX query

Hi All,

I have the below model.

anandav_0-1637799936588.png

Requirement: Calculate the sales of Club Members for the Last 12 Months.

 

DAX query 1 (using Customer Dim): Server Timings  4579 ms FE:24%  SE:76%

DEFINE
    VAR Results =
        CALCULATE (
            DISTINCTCOUNTNOBLANK ( Sales[Customer#] ),
            DISTINCT ( ClubMember[Customer#] ),
            CalendarOptions[Date Options] = "Last 12 Months"
        )
EVALUATE
{ Results }

 

DAX query 2 (using only Fact) : Server Timings  625 ms FE:0%  SE:100%

DEFINE
    VAR Results =
        CALCULATE (
            DISTINCTCOUNTNOBLANK ( Sales[Customer#] ),
            Sales[MemberTypeCode] = 1,
            CalendarOptions[Date Options] = "Last 12 Months"
        )
EVALUATE
{ Results }

 

DAX query 3 (using DIM Club Member Type): Server Timings  625 ms FE:0%  SE:100%

DEFINE
    VAR Results =
        CALCULATE (
            DISTINCTCOUNTNOBLANK ( Sales[Customer#] ),
            ClubMemberTypes[MemberTypeCode] = 1,
            CalendarDateOptions[Date Options] = "Last 12 Months"
        )
EVALUATE
{ Results }

 

Question:

What is the recommended approach in star schema model - using Club Member Dim table to calculate club member sales or having a column in Fact table to indicate Club Member (additional column) and having a Club Member Type Dim table?

 

In DAX, calculating member sales using Club Member Dim table is time consuming (nearly 5 seconds) vs having an additional column in Fact table and using Club Member Type Dim table (625 ms).

I understand the query plan for using Club Member Dim table needs to retrieve 2 Million records first - so it takes time.

 

I wanted to know whether it is better to have an additional column in Fact table to optimise query compared to the storage/memmory cost of the additional column in Fact table? (150 million rows)

Or is there any way to optimise the query that is using the Club Member Dim table - Query 1?

 

Thanks in advance.

 

2 REPLIES 2
anandav
Skilled Sharer
Skilled Sharer

Thanks @amitchandak .

The requirement is calculating sales for members who made pruchases. I have the DAX aueries but I wanted to know which would be a better approach.

 

amitchandak
Super User
Super User

@anandav , with help from date table you can get last 12 month of data like

 

Rolling 12 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-12,MONTH))

 

You should use club memeber only in group by on in measure as filter or group by like in values. Calculation columns you should prefer from the fact (count/sum etc)

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 PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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