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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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