Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

using less or equal in filter

Hi,

 

In a source table I have a field that contains a number between 1 and 50.

In a page I want to show its records using a table vizualisation.

I want to use a slicer with the values 5, 10, 15, 20, 25, ..., 50

If I select e.g. the value 20 in the slicer, then in the table I get all records with the number 1 to 20

If I select e.g. the value 35 in the slicer, then in the table I get all records with the number 1 to 35

etc.

 

I tried to add a new column =(TRUNC((number-1)/5)+1)*5, but selecting 20 in the slicer, then in the table I get only the records with number 16 to 20, selecting 35 in the slicer, then in the table I get only the records with number 31 to 35

 

I tried to use a new table where I typed in the values 5, 10, 15, 20, ... , 50 and use this for the slicer. And I added a filter where number should be less or equal the selected value in the slicer. The filter doesn't work: all records are shown.

 

How can I solve this problem?

 

Thanks

 

R.W.

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

So to replicate your problem I have setup a table in power query that contains two columns, one with an Id column from 0 to 24 and another column with a random integer between 1 and 50 called values. Then I have created another table that just contains numbers between 5 and 50 in increments of 5. There are no relationships between these two tables.

 

Then to get the result you require I have the following measure

 

 

Values Filtered =
    IF (
        HASONEVALUE ( 'Filter Table'[Filter] ) && HASONEVALUE ( 'Table'[Id] ),
        CALCULATE (
            VALUES ( 'Table'[Value] ),
            FILTER ( ( 'Table' ), 'Table'[Value] <= VALUES ( 'Filter Table'[Filter] ) )
        ),
        BLANK ()
    )

What it does is check if in the current context if there is only one value of Id, aka only one row of the Table is in the current context, and that there is only one value selected from the filter table. If either of these are false it will return blank, if you want some kind of aggregation it can be added.

 

 

If the conditions are met then it will display the values that are less than or equal to the selected value of the fitler table.

image.png

 

I hope this helps

 

View solution in original post

Anonymous
Not applicable

@Anonymous,

Yes if you use @Anonymous's DAX. You can add an index column in Query Editor to represent ID.  


1.PNG

Or you can change the DAX to the following ,for more details, please check attached PBIX file. It doesn't require Id column using this DAX.

Measure = 
    IF (
        HASONEVALUE ( Parameter[Parameter] ) && HASONEVALUE ( 'Table1'[Value] ),
        CALCULATE (
            VALUES ( Table1[Value] ),
            FILTER ( ( 'Table1' ), Table1[Value] <= VALUES ( Parameter[Parameter] ) )
        ),
        BLANK ()
    )


1.PNG

Regards,
Lydia

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

So to replicate your problem I have setup a table in power query that contains two columns, one with an Id column from 0 to 24 and another column with a random integer between 1 and 50 called values. Then I have created another table that just contains numbers between 5 and 50 in increments of 5. There are no relationships between these two tables.

 

Then to get the result you require I have the following measure

 

 

Values Filtered =
    IF (
        HASONEVALUE ( 'Filter Table'[Filter] ) && HASONEVALUE ( 'Table'[Id] ),
        CALCULATE (
            VALUES ( 'Table'[Value] ),
            FILTER ( ( 'Table' ), 'Table'[Value] <= VALUES ( 'Filter Table'[Filter] ) )
        ),
        BLANK ()
    )

What it does is check if in the current context if there is only one value of Id, aka only one row of the Table is in the current context, and that there is only one value selected from the filter table. If either of these are false it will return blank, if you want some kind of aggregation it can be added.

 

 

If the conditions are met then it will display the values that are less than or equal to the selected value of the fitler table.

image.png

 

I hope this helps

 

Anonymous
Not applicable

Thomas,

 

Thanks.

 

Is the ID necessary in this construction?

In my table I don't have an ID.

 

R.W.

Anonymous
Not applicable

@Anonymous,

Yes if you use @Anonymous's DAX. You can add an index column in Query Editor to represent ID.  


1.PNG

Or you can change the DAX to the following ,for more details, please check attached PBIX file. It doesn't require Id column using this DAX.

Measure = 
    IF (
        HASONEVALUE ( Parameter[Parameter] ) && HASONEVALUE ( 'Table1'[Value] ),
        CALCULATE (
            VALUES ( Table1[Value] ),
            FILTER ( ( 'Table1' ), Table1[Value] <= VALUES ( Parameter[Parameter] ) )
        ),
        BLANK ()
    )


1.PNG

Regards,
Lydia

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.