Forum Discussion
Power BI Calculating Weekly Sum
- 6 years ago
Hi digitalau ,
To use VALUES function should work.
Measure = CALCULATE ( SUM ( 'Table'[values] ), FILTER ( ALL ( 'Table' ), 'Table'[date] <= MAX ( 'Table'[date] ) ), VALUES ( 'Table'[Wn] ), VALUES ( 'Table'[date].[Year] ) )
Hi digitalau ,
First, make sure you are using a Calculated Measure for _MaxWeeklyImpressions.
If you already are, then it is probably that ALLEXCEPT is not working because you are refering to another table.
I would suggest to bring your Week column into the same table as Impressions, as such:
Create new calculated column in ImpressionShare Table:
NEW WEEK COLUMN = LASTNONBLANK( 'Date'[FW Week Year] , 0 )
Then Update your _MaxWeeklyImpressions measure , as such:
_MaxWeeklyImpressions = CALCULATE(
SUM(ImpressionShare[Impressions]),
ALLEXCEPT('ImpressionShare','ImpressionShare'[NEW WEEK COLUMN)
)Let me know if anything is unclear.
Cheers,
Rob
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Robin,
Thank you for the reply. It is a measure already.
It looks like ALLEXCEPT is not working .
They're coming from different tables linked together with Date Column. ( 1 to Many from Date to ImpressionShare)
The reason I would not want to bring Impressions to Date table is that I am going to have "Date" connections with 12 tables and for several other columns.
I am trying to understand the logic of why it's not working .
There's a 1 to many link between Date and Impression table
- digitalau6 years agoFrequent Visitor
I tried using the method you mentioned .
1. Created a column in ImpressionShare Table : _Week4Impressions , which gives me a week entry in ImpressionShare column
2. Created _SumWeeklyImpressions :
_SUMWeeklyImpressions = CALCULATE(SUM(ImpressionShare[Impressions]),ALLEXCEPT('ImpressionShare','ImpressionShare'[_Week4Impressions])However, now it sums up the whole table . ( no aggregation yet to week level )- ERIC_A3 years agoHelper II
hi in case you need it. this is what I did to get my total per week
weeklysum = calculate(count(Table1[calls]),ALLEXCEPT(Table1,Table1[Creation Week#]))