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

Customization of filter.

Hello everyone!

Hope you all are doing good.

 

I need some help related to filter. I have applied page level filter in my report. Basically our working days are monday to saturday and I have set the filter on page to last day. So on monday its showing sunday which has no record.  So basically I have to filter the page on last day and if last day is sunday then I want data of saturday because thats our last working day.

 

Is it possible?

 

Regards,

Ibad Khan.

1 ACCEPTED SOLUTION

Hi @Ibadkhan ,

 

You may try this LastDaySales measure.

LastDaySales =
IF (
    WEEKDAY ( SELECTEDVALUE ( 'Calendar'[Date] ), 2 ) = 1,
    CALCULATE (
        SUM ( 'Table'[Sales] ),
        FILTER ( 'Table', [Date] = SELECTEDVALUE ( 'Calendar'[Date] ) - 2 )
    ),
    CALCULATE (
        SUM ( 'Table'[Sales] ),
        FILTER ( 'Table', [Date] = SELECTEDVALUE ( 'Calendar'[Date] ) - 1 )
    )
)

 

08/03/2020 is Monday, and it shows the sales of Saturday.

6.png

 

You can check more details from here.

 

 

Best Regards,

Stephen Tao

 

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

4 REPLIES 4
v-stephen-msft
Community Support
Community Support

Hi @Ibadkhan ,

 

1.Create a separate date table.

Calendar = CALENDAR(MIN('Table'[Date]),MAX('Table'[Date]))

3.png

4.png

 

2.Create a measure to display the data of the last day.

LastDaySales = CALCULATE(SUM('Table'[Sales]),FILTER('Table',[Date]=SELECTEDVALUE('Calendar'[Date])-1))

 

3.The result is this. The date of the slicer is created with the date of a separate date table.

result9242552.gif

 

 

You can check more details from here.

 

 

Best Regards,

Stephen Tao

 

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

@v-stephen-msft  i have tried this already. Still facing the same issue. Its working correctly for all days except monday. On monday its showing blank because last day is sunday and there is no record of sunday. Therefore I want data of saturday on monday. 

 

 

Else in other words, If date contains sunday than day - 2 else day - 1.

Hi @Ibadkhan ,

 

You may try this LastDaySales measure.

LastDaySales =
IF (
    WEEKDAY ( SELECTEDVALUE ( 'Calendar'[Date] ), 2 ) = 1,
    CALCULATE (
        SUM ( 'Table'[Sales] ),
        FILTER ( 'Table', [Date] = SELECTEDVALUE ( 'Calendar'[Date] ) - 2 )
    ),
    CALCULATE (
        SUM ( 'Table'[Sales] ),
        FILTER ( 'Table', [Date] = SELECTEDVALUE ( 'Calendar'[Date] ) - 1 )
    )
)

 

08/03/2020 is Monday, and it shows the sales of Saturday.

6.png

 

You can check more details from here.

 

 

Best Regards,

Stephen Tao

 

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

@Ibadkhan ,

Refer to this blog. I have populated the last working day in front of the nonworking day. See if that helps in your logic. 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.