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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
KhrystinaM
Helper I
Helper I

Date slicer showing previous day excluding weekends.

Hello, I have a PowerBI dashboard where I only want to see data from the prior business date. Is there a formula I can write for this?

2 ACCEPTED SOLUTIONS
v-yohua-msft
Community Support
Community Support

Hi, @KhrystinaM 


Based on your information, I create a table:

 

vyohuamsft_0-1706692730278.png

 

Please following these steps:

  1. Create a new column named PreviousData, and use the following DAX expression:

 

vyohuamsft_1-1706692730280.png

 

PreviousData =

VAR a = CALCULATE(SUM('Table'[Value]),FILTER(ALLSELECTED('Table'),'Table'[Date]=EARLIER('Table'[Date])-1))

RETURN

IF(WEEKDAY('Table'[Date])=1||WEEKDAY('Table'[Date])-1=7||WEEKDAY('Table'[Date])-1=1,BLANK(),a)

 

  1. Then create a dashboard, put previousData into the dashboard, create a slicer, and put the Date in, when we select the Date, the dashboard will show the information of the previous day, and will not return the weekend.

 

1.png

 

2.png

 

 

For example, if I select the date as Monday, he will not display the data for Sunday.

 

3.png

If I select a date on Saturday, it will show the value of the previous day, which is Friday.

 

4.png

 

How to Get Your Question Answered Quickly 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Yongkang Hua

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

Hi, @KhrystinaM 
Create a new column in the home page instead of Custom Column in Power Query
.

vyohuamsft_0-1706750695248.png

 

Powe Query uses M and mine is a DAX expression, so it gets an error in Power Query.

Try selecting New column under Modeling and using DAX again.

 

 

How to Get Your Question Answered Quickly 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Yongkang Hua

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

5 REPLIES 5
v-yohua-msft
Community Support
Community Support

Hi, @KhrystinaM 


Based on your information, I create a table:

 

vyohuamsft_0-1706692730278.png

 

Please following these steps:

  1. Create a new column named PreviousData, and use the following DAX expression:

 

vyohuamsft_1-1706692730280.png

 

PreviousData =

VAR a = CALCULATE(SUM('Table'[Value]),FILTER(ALLSELECTED('Table'),'Table'[Date]=EARLIER('Table'[Date])-1))

RETURN

IF(WEEKDAY('Table'[Date])=1||WEEKDAY('Table'[Date])-1=7||WEEKDAY('Table'[Date])-1=1,BLANK(),a)

 

  1. Then create a dashboard, put previousData into the dashboard, create a slicer, and put the Date in, when we select the Date, the dashboard will show the information of the previous day, and will not return the weekend.

 

1.png

 

2.png

 

 

For example, if I select the date as Monday, he will not display the data for Sunday.

 

3.png

If I select a date on Saturday, it will show the value of the previous day, which is Friday.

 

4.png

 

How to Get Your Question Answered Quickly 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Yongkang Hua

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

@v-yohua-msft, thank you for your reply. The calcuate function is throwing an error. 

 

KhrystinaM_0-1706721526600.png

 

Hi, @KhrystinaM 
Create a new column in the home page instead of Custom Column in Power Query
.

vyohuamsft_0-1706750695248.png

 

Powe Query uses M and mine is a DAX expression, so it gets an error in Power Query.

Try selecting New column under Modeling and using DAX again.

 

 

How to Get Your Question Answered Quickly 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Yongkang Hua

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

That worked, thank you!!

PijushRoy
Super User
Super User

Hi @KhrystinaM 

Your message header and body little confusing
You are taking about Slicer data or filter data in Other visual

Can you share details, expected result and screenshot




Did I answer your question? Mark my post as a solution!
Appreciate your Like/Kudos

Proud to be a Super User!





Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.