Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi All,
I have a requirement to display a Power BI report, which has a matrix like below. I want to display a measure (a sum) for only past 14 days from a date selected on slicer. Say if I select 17th January, I should I only see data from 4th January. If I select 16th January--> I should see only data from 3rd January etc.
Can anyone help, please!!
Solved! Go to Solution.
Hi @wolfgangkb-work ,
I create a sample pbix file(see the attachment), please check if that is what you want.
1. Assume that there is one date dimension table, and DO NOT create any relationship with the fact table
2. Create a measure as below
Flag =
VAR _seldate =
SELECTEDVALUE ( 'Date'[Date] )
VAR _fdate =
SELECTEDVALUE ( 'Table'[Date] )
RETURN
IF ( _fdate >= _seldate - 13 && _fdate <= _seldate, 1, 0 )
3. Create a visual and apply the visual-level filter on the visual with the condition(Flag is 1)
In addition, you can refer the following links to get it.
Show Days Before Or After A Selected Date - Advanced Power BI Visual Techniques
If the above one can't help you get the expected result, please provide some raw data in your table (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
Hi @wolfgangkb-work ,
I create a sample pbix file(see the attachment), please check if that is what you want.
1. Assume that there is one date dimension table, and DO NOT create any relationship with the fact table
2. Create a measure as below
Flag =
VAR _seldate =
SELECTEDVALUE ( 'Date'[Date] )
VAR _fdate =
SELECTEDVALUE ( 'Table'[Date] )
RETURN
IF ( _fdate >= _seldate - 13 && _fdate <= _seldate, 1, 0 )
3. Create a visual and apply the visual-level filter on the visual with the condition(Flag is 1)
In addition, you can refer the following links to get it.
Show Days Before Or After A Selected Date - Advanced Power BI Visual Techniques
If the above one can't help you get the expected result, please provide some raw data in your table (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
Hi,
Thank you so much for your answer. I tried your method as it is. And it works perfectly in a table. see below.
But when I convert it to a matrix nothing shows up. I couldn't figure out why that is.
But I managed to get required results uisng the other link you shared . Thanks again!!
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
6 | |
6 | |
3 | |
2 | |
2 |
User | Count |
---|---|
6 | |
5 | |
4 | |
4 | |
3 |