Forum Discussion
Average $ per weekday
- 4 years ago
Hi mcmullenrich
Sorry for the late reply. Here is the workable solution as per sample sampleAverage of Amt := DIVIDE ( SUM ( Combined[Amount] ), COUNTROWS ( FILTER ( 'Calendar', NOT ISBLANK ( Combined[Sum of Amt] ) ) ) )
That is clear enough. But in Power Bi you have a date table with the weekday name column and this table is connected with the fact table through the date column. Is that correct?
Yes, that's correct
- mcmullenrich4 years agoFrequent Visitor
Not quite there yet. I realized the issue, just not sure how to solve in DAX. My excel-based approach above only works if I have a single entry for each date (i.e., a daily deposit amount). However, in my PBI table, I have multiple transactions for each date. As such, your approach gives me much smaller numbers than it should be. I need to find a way to sum by date before adding and counting.
- tamerj14 years ago
Community Champion
Hi mcmullenrich
Sorry for the late reply. Here is the workable solution as per sample sampleAverage of Amt := DIVIDE ( SUM ( Combined[Amount] ), COUNTROWS ( FILTER ( 'Calendar', NOT ISBLANK ( Combined[Sum of Amt] ) ) ) ) - tamerj14 years ago
Community Champion
Then I hope the last solution works.
- tamerj14 years ago
Community Champion
mcmullenrich
Even though, COUNTROWS ( 'Calendar' ) should give the frequency count of the selected weekday as the date table has no duplicates. Can you please share some screenshots of you tabels, data model, report and the measure? - mcmullenrich4 years agoFrequent Visitor
This feels a bit like I cheated, but it did get me the result that I wanted:
Average per Weekday :=
DIVIDE ( [Sum of Amt], MAX ( Combined[WeekNo] ) - MIN ( Combined[WeekNo] ) + 1 )