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
sudhakar111
Helper IV
Helper IV

Days Bracket Filter in Report

Dear All,

 

I need help in creating a days bucket formula, which will be used in the report as a filter.

 

Below is the code i wrote.The problem with this is when bracket 30 is selected it shows only dates which are above 7. It does not show dates below 7 days. Same with 60 days,it shows dates above 30 days.

Date_Condition = Max(Last_Execution_Date)-Last_Execution_Date

 

Days_Filter = if(('Exchange'[Date_Condition]>=1 &&'Exchange'[Date_Condition]<=7),7,if(('Exchange'[Date_Condition]>=1 && 'Exchange'[Date_Condition]<=30),30,if(('Exchange'[Date_Condition]>=1 && 'Exchange'[Date_Condition]<=60),60)))

5 REPLIES 5
sudhakar111
Helper IV
Helper IV

Thank you both for your response. Please find the link to sample information. User Name and Last Activity date have to be displayed in the table. Based on the slicer selection,the user and last activity date have to be filtered.

 

https://onedrive.live.com/?id=1F5A3C32EB7ABDBA%21104&cid=1F5A3C32EB7ABDBA 

V-pazhen-msft
Community Support
Community Support

@sudhakar111 

You cannot do that by creating a calculate column using IF(). Try the following method:

 

1. Create a "Slicer Table" with Enter Data, enter value, 7,30,60. 

slicer table.JPG

2. Create a measure. 

 

Measure = CALCULATE(MAX([Date_Condition]),FILTER('Table',[Date_Condition]<=SELECTEDVALUE('Slicer Table'[Slicer])))

 

3. Create a slicer with the Slicer column from the new table to filter. 


Paul Zheng _ Community Support Team
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@V-pazhen-msft  Created the measure and slicer. When a range is selected in the filter it is also displaying other ranges,and they are showing as empty. When a selection is made, other ranges should not be displayed on the table.

@sudhakar111 

I cannot access to the onedrive link you provided.

 

Paul

AllisonKennedy
Super User
Super User

You may need to use custom measures for the values, rather than just normal sums in this case.

If I understand your question correctly you may be looking for something similar to a running total, that when 30 is selected, displays all 30 days or less.

There are a few ways to do this, see if this link helps, otherwise please share table and column names for your data and a desired result.

https://www.sqlbi.com/articles/computing-running-totals-in-dax/

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

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.