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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
michaelJack
Frequent Visitor

Need help to create a table containing actual, MTD,YTD,Lastmonth

Hi friends,

i have a dataset with date, storekey, revenue, quantity, revenue_target, Quantity_target.

I need you help to create a new table inside PowerBI that contain all of measure including actual, MTD, YTD,Lastmonth values with date and storekey are dimension , i tried many times with few functions like sumarize() or addcolumn() but the values for MTD and YTD are always wrong or null. 

Coud anyone help me or give your advices on this situation? 

 

I could share my dataset as link:
https://www.dropbox.com/s/bt4c7z90zp4dys4/test.pbix?dl=0

Thank in advanced,
J.

1 ACCEPTED SOLUTION
v-qiuyu-msft
Community Support
Community Support

Hi @michaelJack,

 

You can create a calculated table below: 

 

Test_Sumarize = SUMMARIZE(
Revenue,
Revenue[StoreKey],
Revenue[OrderDate],
"Revenue_act",SUM(Revenue[Revenue]),
"Revenue_act_MTD",CALCULATE(SUM(Revenue[Revenue]),FILTER(ALL(Revenue),'Revenue'[OrderDate]<=MAX(Revenue[OrderDate]) && MONTH('Revenue'[OrderDate])=MONTH(MAX(Revenue[OrderDate])) && YEAR(Revenue[OrderDate])=YEAR(MAX(Revenue[OrderDate])))),
"Revenue_act_YTD",CALCULATE(SUM(Revenue[Revenue]),FILTER(ALL(Revenue),'Revenue'[OrderDate]<=MAX(Revenue[OrderDate]) && YEAR(Revenue[OrderDate])=YEAR(MAX(Revenue[OrderDate]))))
)

 

w1.PNG

 

You can see attached pbix file. 

 

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-qiuyu-msft
Community Support
Community Support

Hi @michaelJack,

 

You can create a calculated table below: 

 

Test_Sumarize = SUMMARIZE(
Revenue,
Revenue[StoreKey],
Revenue[OrderDate],
"Revenue_act",SUM(Revenue[Revenue]),
"Revenue_act_MTD",CALCULATE(SUM(Revenue[Revenue]),FILTER(ALL(Revenue),'Revenue'[OrderDate]<=MAX(Revenue[OrderDate]) && MONTH('Revenue'[OrderDate])=MONTH(MAX(Revenue[OrderDate])) && YEAR(Revenue[OrderDate])=YEAR(MAX(Revenue[OrderDate])))),
"Revenue_act_YTD",CALCULATE(SUM(Revenue[Revenue]),FILTER(ALL(Revenue),'Revenue'[OrderDate]<=MAX(Revenue[OrderDate]) && YEAR(Revenue[OrderDate])=YEAR(MAX(Revenue[OrderDate]))))
)

 

w1.PNG

 

You can see attached pbix file. 

 

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.