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
Klaus
Regular Visitor

Dynamic filtering of rows using a parameter

Hello,

 

I have a table with two attributes: [order_dates] and [sales]. I want to filter rows fitting the following condition:

number of days between MAX(Order_Date) and order_date >= X.

X should be selected by the user through a parameter. The parameter must be visible on the report page.

That means, a query parameter cannot be used

 

I created a parameter table, which holds all possible values for X.

Then I created a calculated column as follows

Flag =
IF (
    DATEDIFF ( 'data'[order_date]; [Latest_Order_Date]; DAY )
        >= SELECTEDVALUE ( 'ParameterTable'[Value] );
    "INCLUDE";
    "EXCLUDE"
)

 

Latest_Order_Date is defined as follows:

Latest_Order_Date =
MAXX (
    ALL ( 'data' );
    'data'[order_date]
)

 

Unfortunately this does not work. Whatever value I select in the parameter table has absolutely no effect. What I am doing wrong?

 

 

 

Thanks a lot in advance,

 

Klaus

 

 

2 ACCEPTED SOLUTIONS
BILASolution
Solution Specialist
Solution Specialist

Hi @Klaus

 

You can try this...

 

1. Create a new calculated column (days)

 

days = DATEDIFF(Sales[OrderDate];MAX(Sales[OrderDate]);DAY) 

 

1.png

 

 

2. Finally, Use it as an slicer. Look the picture below.

 

2.png

 

NOTE: The right side of the slicer must be in the right limit

 

I hope this helps

Regards

View solution in original post

Thank you a lot!

 

You are right. In this case a parameter is absolutely not necessary.

 

Your suggestion works perfectly.

 

Kindest regards

View solution in original post

2 REPLIES 2
BILASolution
Solution Specialist
Solution Specialist

Hi @Klaus

 

You can try this...

 

1. Create a new calculated column (days)

 

days = DATEDIFF(Sales[OrderDate];MAX(Sales[OrderDate]);DAY) 

 

1.png

 

 

2. Finally, Use it as an slicer. Look the picture below.

 

2.png

 

NOTE: The right side of the slicer must be in the right limit

 

I hope this helps

Regards

Thank you a lot!

 

You are right. In this case a parameter is absolutely not necessary.

 

Your suggestion works perfectly.

 

Kindest regards

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.

Top Solution Authors