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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Workingday Number fails when refresh in service

Hi all, 

 

I have a datetable that among other things calculates the workday Number for each month: 

 

Works great in desktop, but when I refresh in service it counts each day as two instead of one. For example, September should look like: 

Maols_3-1599661764441.png

 

But after refresh: 

Maols_2-1599661723529.png

 

The formula for Workday number is:

Workday Number =
VAR CurrentMonth = Dates[Period]
VAR Monthtable = FILTER(ALL( Dates ), Dates[Day type 2] = "Workday" && Dates[Period] = CurrentMonth )
RETURN
IF(Dates[Day type 2] = "Weekend",
BLANK(),
RANKX( MonthTable, CALCULATE( AVERAGE( Dates[DayofMonth] ) ), , ASC ))
 
 
I'm really stumped. If anyone has an idea of what I could have done wrong please come with an suggestion. I would be eternally grateful. 
 
 
2 ACCEPTED SOLUTIONS
Greg_Deckler
Community Champion
Community Champion

@Anonymous - What if you try this:

Workday Number =
VAR CurrentMonth = Dates[Period]
VAR Monthtable = 
  FILTER(
    ALL( Dates ), 
    Dates[Day type 2] = "Workday" && Dates[Period] = CurrentMonth && [Date]<=EARLIER([Date])
  )
RETURN
  COUNTROWS(Monthtable)


Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

v-deddai1-msft
Community Support
Community Support

Hi @Anonymous ,

 

Would you please try to use the following calculated column, it works well based on my test:

 

WorkDay Number = IF('Table'[Day type 2] = "Weekend",BLANK(),RANKX(FILTER('Table','Table'[Period] = EARLIER('Table'[Period])&&'Table'[Day type 2] = "WorkDay"),'Table'[Date],,ASC))

 

 

Capture2.PNG

 

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

 

Best Regards,

Dedmon Dai

View solution in original post

3 REPLIES 3
v-deddai1-msft
Community Support
Community Support

Hi @Anonymous ,

 

Would you please try to use the following calculated column, it works well based on my test:

 

WorkDay Number = IF('Table'[Day type 2] = "Weekend",BLANK(),RANKX(FILTER('Table','Table'[Period] = EARLIER('Table'[Period])&&'Table'[Day type 2] = "WorkDay"),'Table'[Date],,ASC))

 

 

Capture2.PNG

 

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

 

Best Regards,

Dedmon Dai

Greg_Deckler
Community Champion
Community Champion

@Anonymous - What if you try this:

Workday Number =
VAR CurrentMonth = Dates[Period]
VAR Monthtable = 
  FILTER(
    ALL( Dates ), 
    Dates[Day type 2] = "Workday" && Dates[Period] = CurrentMonth && [Date]<=EARLIER([Date])
  )
RETURN
  COUNTROWS(Monthtable)


Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Greg_Deckler
Community Champion
Community Champion

@Anonymous Wow, that is super bizarre, not sure I have ever seen that. And not sure how to troubleshoot either. I'll try to take a deeper look at the DAX code. This is import mode I take it. 

 

If all else fails. You could check the Issues forum here:

https://community.powerbi.com/t5/Issues/idb-p/Issues

And if it is not there, then you could post it.

If you have Pro account you could try to open a support ticket. If you have a Pro account it is free. Go to https://support.powerbi.com. Scroll down and click "CREATE SUPPORT TICKET".



Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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