Forum Discussion
SUM multiple month values over years
- 4 years ago
Anonymous
Try:
Aggregation 3 = IF ( ISINSCOPE ( 'Date'[Month] ), CALCULATE ( SUMX ( Sales, Sales[Quantity] * Sales[Net Price] ), ALLEXCEPT ( 'Date', 'Date'[Month] ) ), SUMX ( FILTER ( ALL ( Sales ), YEAR ( [Order Date] ) <= SELECTEDVALUE ( 'Date'[Calendar Year Number] ) ), Sales[Quantity] * Sales[Net Price] ) )Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please upload some insensitive data samples and expected output.
Best Regards,Community Support Team _ Janey
Hi, Anonymous
Do you want to calculate like below?
You can try:
Aggregation 2 =
SUMX (
FILTER (
ALL ( Sales ),
YEAR ( [Date] ) <= YEAR ( SELECTEDVALUE ( Sales[Date] ) )
&& MONTH ( [Date] ) = MONTH ( SELECTEDVALUE ( Sales[Date] ) )
),
Sales[Quantity] * Sales[Net Price]
)
Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please upload some insensitive data samples and expected output.
Best Regards,
Community Support Team _ Janey
- Anonymous4 years agoNot applicable
Thank you for the reply v-janeyg-msft . I've tried to incorporate this measure into the sample but no luck. The Sales table only has an 'Sales'[Order Date] and I have been using 'Date'[Date] for the visual above but I can't bring 'Date'[Date]' into the measure:
Aggregation 2 =
SUMX (
FILTER (
ALL ( Sales ),
YEAR ( [Order Date] ) <= YEAR ( SELECTEDVALUE (Sales[Order Date] ) )
&& MONTH ( [Order Date] ) = MONTH ( SELECTEDVALUE ( Sales[Order Date] ) )
),
Sales[Quantity] * Sales[Net Price]
)Do I need to cross filter somehow? From your visual above is there a pbix you can share?- v-janeyg-msft4 years ago
Community Support
Hi, Anonymous
The picture is yours, I just ask about your needs. You didn’t provide a sample file. How could I have it? I iust wrote the code according to your description.
If you still need help, please upload some insensitive data samples and expected output, So we can help you soon.
Best Regards,
Community Support Team _ Janey
- Anonymous4 years agoNot applicable
Apologies.
Please find link attached to file.
https://www.dropbox.com/s/giyeda55w6ybv7f/Monthly%20Average%20Over%20Years.pbix?dl=0