Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Dev_Pat
Frequent Visitor

MDX query for Specific Year

Hi Team,

I need a help to develop a MDX query.

Below is the detail requirement. Any help much appriciated.

 

A calculated column, which will give me 2019 volume number to respective month errecpective of any year in the row. Below is a sample table.

 Volume2019 Volume
1/1/202054.89 
2/1/202051.64 
3/1/202098.12 
4/1/202011.62 
5/1/202084.98 
6/1/202087.16 
7/1/202052.81 
8/1/202046.45 
9/1/202048.92 
10/1/202020.93 
11/1/202012.60 
12/1/202031.71 
1/1/20217.83 
2/1/202183.78 
3/1/202173.19 
4/1/202137.44 

 

Best Regards

Dev

5 REPLIES 5
v-jingzhang
Community Support
Community Support

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

MarketCategoryMonthVolumeVolume_2019
Market-1Category-11/1/202160.3939.16
Market-2Category-11/1/20200.5939.16
Market-3Category-11/1/201939.1639.16
     
Market-1Category-12/1/202135.1537.10
Market-2Category-12/1/202060.2537.10
Market-3Category-12/1/201937.1037.10
     
Market-1Category-13/1/202176.2055.40
Market-2Category-13/1/202033.5655.40
Market-3Category-13/1/201955.4055.40

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] ) )
)

072304.jpg

 

Regards,
Community Support Team _ Jing
If this post helps, please Accept it as the solution to help other members find it.

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] ) )
)

072304.jpg

 

Regards,
Community Support Team _ Jing
If this post helps, please Accept it as the solution to help other members find it.

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] ) )
)

072304.jpg

 

Regards,
Community Support Team _ Jing
If this post helps, please Accept it as the solution to help other members find it.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

Top Solution Authors