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
vijay273162
Helper III
Helper III

SAMEPERIODLASTYEAR based on Running Days

Hi All,

Refer the below Simplified example.

vijay273162_0-1652770931079.png

 

 

So, I need to go back to PREVIOUS YEAR SAME QUARTER and based on Running day number, need to get the Total Sales value.

 

If I use SAME PERIODLAST YEAR, it only takes "total sales" for that date, this will not consider the logic of summing Weekend data ith Monday.

 

Please tell me, how to use Running Day number columns to get previous year "Total sales" data

3 REPLIES 3
vijay273162
Helper III
Helper III

HI Amit,

 

Not to compare Weekday of CY with Weekday of PY.

But, to compare, Running days no. of Current year with Running Day no. of Previous year.

 

Running Day no. is calculated as you said earlier using DAX CODE.

 

DESC - Running days_Quarter_(Excl_Wknd) =
COUNTROWS(
FILTER(
ADDCOLUMNS(CALENDAR(Period[Date],Period[End date of Quarter]),
"WorkDay", if(WEEKDAY([Date],2) <6,1,0)),
[WorkDay] =1)
)
)
 
So, it will exlcude Weekends while counting running days in Quarter.

Hi @vijay273162 ,

 

I can see "PY" and "CY" in your screenshot, are they from same table or from two different tables. I know they have the same format. If they are from two tables, I suggest you to combine them into one table in Power Query Editor.

For reference: Append queries

Could you share a sample file with me and show me the result you want? This will make it easier for me to find the solution.

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

amitchandak
Super User
Super User

@vijay273162 , Not very clear, Do you want to compare Week day of this with same weeikday last year ?

that will like

week Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-364,DAY))

 

 

Or do want work across work days

Traveling Across Workdays - What is next/previous Working day
https://community.powerbi.com/t5/Community-Blog/Travelling-Across-Workdays-Decoding-Date-and-Calenda...

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.