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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Weekday current year vs last year

HI @CheenuSing

 

I have seen lots of posts, but i havent been able to implement this in my case. 

 

basically i want to do this functionality

 

on monday, it should show fridays sales CY and friday sales LY 

on tues, it should show monday sales  CY and Monday sales LY 

 

eg today (monday)  1/21/2019 

DAILY Sales CY  = , it should display last fridays sales i.e  1/18/2019 (3rd week friday )   

DAILY SALES LY =  (1/19/2018) (3rd week friday ) 

because sometimes we have sales on sat/sunday.. 

so i used lastprocessed (date) = returned 1/20/2019 but for sunday of last year ( 1/21/2018) there were no sales ..thereby getting blanks 

 

so i want to create calculated measures/columns 

so that i can create daily sales report for sales, net profit and gross profit 

 

Please help me out. 

 

Sending a screenshot of the report as well as the date 

 

MTD and YTD are calculating fine ( they need to include all sales (including weekends) ) 

 

THANKS A LOT IN ADVANCE 

DATA.jpgREPORT.JPG

6 REPLIES 6
v-juanli-msft
Community Support
Community Support

Hi @Anonymous

"

eg today (monday)  1/21/2019 

DAILY Sales CY  = , it should display last fridays sales i.e  1/18/2019 (3rd week friday )   

DAILY SALES LY =  (1/19/2018) (3rd week friday ) 

because sometimes we have sales on sat/sunday.. 

so i used lastprocessed (date) = returned 1/20/2019 but for sunday of last year ( 1/21/2018) there were no sales ..thereby getting blanks 

"

 

Would you like to get MTD or YTD values?

for example ,

eg today (monday)  1/21/2019 

DAILY Sales CY=values from 2019/1/1 to 2019/1/21

DAILY SALES LY =2018/1/1 to 2018/1/21

 

or you just want to get the values on one day?

 

Please clear me.

 

Best Regards

Maggie

Anonymous
Not applicable

Just values of one day. 

"Daily sales "

CheenuSing
Community Champion
Community Champion

Hi @Anonymous

 

I am a bit confused about your statement

 

"

because sometimes we have sales on sat/sunday.. 

so i used lastprocessed (date) = returned 1/20/2019 but for sunday of last year ( 1/21/2018) there were no sales ..thereby getting blanks "

 

The blank for previous year is what you expect ? Or you would like to go back further to say 1/20/2018 saturday if it had sales or 1/19/2018 Friday which would have had sales .

 

Kindly calrify.

 

Cheers

 

CheenuSing

Did I answer your question? Mark my post as a solution and also give KUDOS !

Proud to be a Datanaut!
Anonymous
Not applicable

So @CheenuSing

on monday 1/28/2019 , it should show daily sales of last friday (1/25/2019)  , vs same friday lasy year (1/26/2018)

 

this is resolved 

 

Total Sales CY Yesterday = CALCULATE([Total Sales], LASTDATE('Financial Data'[date_dt]))

Total Sales LY Yesterday = CALCULATE([Total Sales], DATEADD(LASTDATE('Financial Data'[date_dt]),-364,DAY))

 

but i ran into one more issue, if you could help me out 

 

for MTD values 

 

CY : it should calculate till 1/1/2019 to 1/27/2019 -- this is working 

 LY: it should calculate till 1/1/2018 to 1/28/2018 -- per calendar days; but 1/28/2018 is a weekend so the value is coming blank 

 

Total Sales MTD CY = CALCULATE(TOTALMTD([Total Sales],'Financial Data'[date_dt])) -- this is correct 

Total Sales MTD LY = TOTALMTD(SUM('Financial Data'[SaleAmount]), DATEADD(LASTDATE('Financial Data'[date_dt]),-364,DAY))

 

 

 

 

 

Greg_Deckler
Super User
Super User

See if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

No, 

 

This wont work for me.  MTD and YTD is no problem. What i am struggling with  is 

eg. 

today monday 1/21/2019 

it should fetch friday s total sales for 2019 i.e.  1/18/2019 --> this is working 

for friday of last year i.e. 1/19/2018 --> this is not working 

 

Daily sales report.. Not week. 

 

so how to filter for a particular date ? 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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