Forum Discussion
Date Dimension Table and Calculating Averages
I have a fact table with event attendance that has multiple data points for the same day/week (for different locations and times). I also have a master date dimension table. The two tables are related. In 2020, we had multiple weeks where we did not host events, and therefore have no data for those dates in the fact table. I'm trying to calculate average weekly attendance. When I use the formula
Average = SUM(Fact_Table[YValue]) / DISTINCTCOUNT(Dim_Date_Table[CalendarWeekNumber])
the distinct count returns 53, not the number of weeks that we have data for in the fact table. Is there a way to use the date table in the calculation, but for it to only use data for corresponding dates in the fact table? Thanks!
Hi
Can you try with belwo dax?
Average = SUM(Fact_Table[YValue]) / CALCULATE(DISTINCTCOUNT(Dim_Date_Table[CalendarWeekNumber],FACTTABE[DATECOLUMN]))
Appreciate a Kudos! π
If this helps and resolves the issue, please mark it as a Solution! πRegards,
N V Durga Prasad
1 Reply
- nvprasad
Solution Sage
Hi
Can you try with belwo dax?
Average = SUM(Fact_Table[YValue]) / CALCULATE(DISTINCTCOUNT(Dim_Date_Table[CalendarWeekNumber],FACTTABE[DATECOLUMN]))
Appreciate a Kudos! π
If this helps and resolves the issue, please mark it as a Solution! πRegards,
N V Durga Prasad