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
Mahmoodul
Helper I
Helper I

Trying to find the difference between Today count and Previous day count on weekdays

Trend.png

Hi Team,

Trying to find the difference between Today count and Previous day count on weekdays.I am already calculate the difference but problem i am facing here is When it is weekend becuase my report based on Weekdays(monday to Friday).Monday to friday is showing good but on weeknd it is not coming correct becuase weekend date is not available(Suppose friday date is 4thSep and (5th and 6th is weeknd) and 7th is Monday so i wanted my Today date is 7th and previous date is 4th, i want to exclude weekend  in report date.

How can i find the difference between Today and Previous day on weekdays.

Clumn NAME below

reportdate

Sub region

Calls

@Tahreem24 

6 REPLIES 6
Greg_Deckler
Super User
Super User

@Mahmoodul Just to add to @Tahreem24 , there is a Quick Measure Gallery item for this as well. https://community.powerbi.com/t5/Quick-Measures-Gallery/Net-Work-Days/m-p/367362#M109


@ 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...
Tahreem24
Super User
Super User

@Mahmoodul ,

In order to exclude weekend from data so use this method:

  • Add a calculated column  IsWeekend = IF(WEEKDAY(Table1[RepoortingDate])>5,1,0)

  • Filter your visual by IsWeekend is 0 (This will exclude weekend)

  • You can then calculate Count.
Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard

Hi Team

6789.png

I am using you above Dax but not getting proper result, if you see the attched image when we select 7th sep I.E Monday(Today Date) and 4th sep i.e Friday(Previous Day), it is not coming.Everyday it is working but When i I select Monday date and Friday date, it is not working.Can you please help me

 

@Tahreem24 

@TomMartens 

@parry2k 

@mwegener

hi  @Mahmoodul 

For this case, you need to add Date field into "Columns", since there is no row context for date, 

7th sep previous is 4th sep, 4th sep previous is 3th sep, if you selected two days, how do you want it show in this matrix visual?

 

so for your case, you could try these two ways:

1. Only select one date in the slicer

2. Drag date field into "Columns" of matrix too.

 

If you still have the problem, please share your sample pbix file, that will be a great help.

 

Regards,

Lin

Community Support Team _ Lin
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

@Mahmoodul , Create a Rank on week days. refer the steps here

https://community.powerbi.com/t5/Community-Blog/Travelling-Across-Workdays-Decoding-Date-and-Calenda...

Work Day = if(WEEKDAY([Date],2)>=6,0,1)
Work Date = if(WEEKDAY([Date],2)>=6,BLANK(),[Date])
Work Date Cont = if([Work Day]=0,maxx(FILTER('Date',[Date]<EARLIER([Date]) && [Work Day]<> EARLIER([Work Day]) ),[Date]),[Date])
Work Date cont Rank = RANKX(ALL('Date'),[Work Date Cont],,ASC,Dense)

 

Work on this day vs last day like

This Day = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Work Date cont Rank]=max('Date'[Work Date cont Rank])))
Last Day = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Work Date cont Rank]=max('Date'[Work Date cont Rank])-1))

can you please convert this with my given column, I am unable to do it.

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.