Forum Discussion
MDX query for Specific Year
Hi Dev_Pat
Can you provide the expected output based on your sample table? Currently I don't understand what should be the expected result. Thanks.
Regards,
Community Support Team _ Jing
Hi v-jingzhang ,
Volume_2019 column is the expected column from first 4 column.
Can we write MDX code to get 5th column? irrespective of year in month column, can we get the number of 2019 in new calcuated column?
Thanks
| Market | Category | Month | Volume | Volume_2019 |
| Market-1 | Category-1 | 1/1/2021 | 60.39 | 39.16 |
| Market-2 | Category-1 | 1/1/2020 | 0.59 | 39.16 |
| Market-3 | Category-1 | 1/1/2019 | 39.16 | 39.16 |
| Market-1 | Category-1 | 2/1/2021 | 35.15 | 37.10 |
| Market-2 | Category-1 | 2/1/2020 | 60.25 | 37.10 |
| Market-3 | Category-1 | 2/1/2019 | 37.10 | 37.10 |
| Market-1 | Category-1 | 3/1/2021 | 76.20 | 55.40 |
| Market-2 | Category-1 | 3/1/2020 | 33.56 | 55.40 |
| Market-3 | Category-1 | 3/1/2019 | 55.40 | 55.40 |
- v-jingzhang5 years agoCommunity Support
Hi Dev_Pat
I don't know much about MDX. If it's possible to use DAX, you can use below codes:
Column = CALCULATE ( SUM ( 'Table'[Volume] ), ALL ( 'Table' ), YEAR ( 'Table'[Month] ) = 2019, MONTH ( 'Table'[Month] ) = MONTH ( EARLIER ( 'Table'[Month] ) ) )Regards,
Community Support Team _ Jing
If this post helps, please Accept it as the solution to help other members find it. - Syndicate_Admin5 years agoAdministrator
Hi @Dev_Pat
I don't know much about MDX. If it's possible to use DAX, you can use below codes:
Column = CALCULATE ( SUM ( 'Table'[Volume] ), ALL ( 'Table' ), YEAR ( 'Table'[Month] ) = 2019, MONTH ( 'Table'[Month] ) = MONTH ( EARLIER ( 'Table'[Month] ) ) )Regards,
Community Support Team _ Jing
If this post helps, please Accept it as the solution to help other members find it. - Syndicate_Admin5 years agoAdministrator
Hi @Dev_Pat
I don't know much about MDX. If it's possible to use DAX, you can use below codes:
Column = CALCULATE ( SUM ( 'Table'[Volume] ), ALL ( 'Table' ), YEAR ( 'Table'[Month] ) = 2019, MONTH ( 'Table'[Month] ) = MONTH ( EARLIER ( 'Table'[Month] ) ) )Regards,
Community Support Team _ Jing
If this post helps, please Accept it as the solution to help other members find it.