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

How to create a measure to get date of last 5 days

Hi Experts,

 

I have a requirement where we are using a matrix for showing data and need to build a button(Last 5 days date) and when we click on that it should show only the last 5 days' data in the matrix,

For particular requirements on how to build a measure, Need your input and suggestions

 

Thanks in advance,

 

Regards,

Hk

1 ACCEPTED SOLUTION
MohammadLoran25
Solution Sage
Solution Sage

Hi @kousar99 ,

 

1-You can create a flag column. If gives 1 value (or the text "Last 5 days") to the records that are last 5 days (Today and 4 days before). Then you can put this column as a slicer which contains last 5 days.

 

2-In terms of measure, You can do this:

Last5DaysMEasure =
CALCULATE (
    [YourMeasure],
    FILTER (
        ALL ( 'DateTable' ),
        'DateTable'[Date]
            >= TODAY () - 4
            && 'DateTable'[Date] <= TODAY ()
    )
)

 

If this answer solves your problem, give it a thumbs up and mark it as an accepted solution so the others would find what they need easier.

Regards,
Loran

View solution in original post

1 REPLY 1
MohammadLoran25
Solution Sage
Solution Sage

Hi @kousar99 ,

 

1-You can create a flag column. If gives 1 value (or the text "Last 5 days") to the records that are last 5 days (Today and 4 days before). Then you can put this column as a slicer which contains last 5 days.

 

2-In terms of measure, You can do this:

Last5DaysMEasure =
CALCULATE (
    [YourMeasure],
    FILTER (
        ALL ( 'DateTable' ),
        'DateTable'[Date]
            >= TODAY () - 4
            && 'DateTable'[Date] <= TODAY ()
    )
)

 

If this answer solves your problem, give it a thumbs up and mark it as an accepted solution so the others would find what they need easier.

Regards,
Loran

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.