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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors