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
MichelBrown
Regular Visitor

DAX formula weighted average support requested

Hello community,

Can someone help me with a DAX formula to calculate average sales per store per period and per region as in the below example?

 

Even after reading many questions on the same topic, I can't get it to work. My DAX attempt in the screenshot comes close but the aggregated results on period level and store level are ok, but not on total and not on Region level.

Here is the model and my DAX attempt (DIVIDE(SUM(fact_Sales[Sale]);SUMX(fact_Sales;RELATED(dim_Regions[Number of stores]));0))

 

MichelBrown_0-1637590197887.png

Thanks in advance for any support.

Michel

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

Assuming you're using dim_Regions[Region] in your visual, you should be able to define the ratio as:

Sales per store =
DIVIDE (
    SUM ( fact_Sales[Sale] );
    SUM ( dim_Regions[Number of stores] );
    0
)

View solution in original post

3 REPLIES 3
MichelBrown
Regular Visitor

Hello AlexisOlson,

Thanks for your reply, this is indeed the (a?) solution that solves the problem from my question. It shows me again that I'm not used to thinking in a DAX way, in Excel I would have solved the issue probably much faster.

DAX definitely takes some getting used to. I like it much better than Excel formulas now though (which tend to be difficult to read).

AlexisOlson
Super User
Super User

Assuming you're using dim_Regions[Region] in your visual, you should be able to define the ratio as:

Sales per store =
DIVIDE (
    SUM ( fact_Sales[Sale] );
    SUM ( dim_Regions[Number of stores] );
    0
)

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.

Top Solution Authors