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
mbailey
Helper II
Helper II

How to compare number of records displayed to number of table records?

I have a report/dashboard that is shared with several users. The report has many slicers (filters) in it and some are long scrolling lists of customers, order numbers, etc.  I'm trying to come up with a way to visually indicate on the report if it's being Filtered or not since to my knowledge, there is not a built-in indicator.

An idea I had was comparing the number of records that would be displayed in an unfiltered view with the number being displayed with a filter applied. For example, unfiltered there are 1359 records displayed in my table grid. If I selected a particular customer and then only 895 records were displayed, I could test for "IF TotalRecords - DisplayedRecords >0". If the result was > 0, then I'd like to display a text message that says "FILTERED" somewhere on the report. I'm not even sure if you can conditionally display text or not?

 

Thanks,

Mike Bailey

1 ACCEPTED SOLUTION

@mbailey

 

Noted that you are using a Dirrect Query Mode and not Import Data.

 

To make the MessageFilterText to work properly, please follow the steps.

1. Clik on File 

2. Click Options and Settings

3. Choose Options

4. Under the Global column choose DirectQuery

5. Enable Allow Unrestricted measures in DIrectQueryMode.

6. Click OK

7. Save and exit

8. Open the PowerBI and open your pbix file , the MessageFilterText will work without giving error.

 

Just to add on,  the step 5 to enable the option,  will also allow some of the time inelligence to work.

 

If this solves your issue please accept this as solution and also give KUDOS.

 

Cheers

CheenuSIng 

 

 

 

Did I answer your question? Mark my post as a solution and also give KUDOS !

Proud to be a Datanaut!

View solution in original post

8 REPLIES 8
Vvelarde
Community Champion
Community Champion

@mbailey

 

hello;

 

Create a measure and put in a Card Visual

 

Message-Filter = if (COUNTROWS(ALL(Table1))-COUNTROWS(Table1)>0;"Filtered","No Filter")




Lima - Peru

Hi,

 

I put this in place and it doesn’t seem to work. When no filters are applied, it says Filtered, and when I apply a filter it still says Filtered. See below screen shots.

 

Message-Filter = if (COUNTROWS(ALL(DMTA_Service_Report))-COUNTROWS(DMTA_Service_Report)>0,"Filtered","No Filter")

 

This show the name of the table used in the measure, and the number of rows when Unfiltered:

Measure1.jpg

 

Here you can see I’ve selected a Filter, and the number of rows has changed, but the Measure still says Filtered:

Measure2.jpg

 

Thank you for your help!

 

Mike

Hi @mbailey

 

You could try using HASONEVALUE to check if there are selections made in any slicer.

 

I see you have two slicers SRO Type and Stat. Use the expression as below

 

MessageFIlter =
                   If (HASONEVALUE(YourTable[SRO Type]) || HASONEVALUE(YourTable[Stat])
                                            ,"Filtered"
                                            , "Not Filtered")

 

HASONEVALUE helps to check if value in a slicer has been selected.

 

If this solves your issue please accept this as a solution and also give KUDOS.

 

Cheers

 

CheenuSing

Did I answer your question? Mark my post as a solution and also give KUDOS !

Proud to be a Datanaut!

Hi CheenSing,

 

I'm am getting this error message when I try your formula:

 

     Function 'COUNTROWS' is not supported in this context in DirectQuery mode.

 

Here is the formula:

    MessageFIlter = If (HASONEVALUE(DMTA_Service_Material_Report[sro_type]) || HASONEVALUE(DMTA_Service_Report[Stat]),"Filtered", "Not Filtered")

 

Thanks,

Mike

@mbailey

 

Noted that you are using a Dirrect Query Mode and not Import Data.

 

To make the MessageFilterText to work properly, please follow the steps.

1. Clik on File 

2. Click Options and Settings

3. Choose Options

4. Under the Global column choose DirectQuery

5. Enable Allow Unrestricted measures in DIrectQueryMode.

6. Click OK

7. Save and exit

8. Open the PowerBI and open your pbix file , the MessageFilterText will work without giving error.

 

Just to add on,  the step 5 to enable the option,  will also allow some of the time inelligence to work.

 

If this solves your issue please accept this as solution and also give KUDOS.

 

Cheers

CheenuSIng 

 

 

 

Did I answer your question? Mark my post as a solution and also give KUDOS !

Proud to be a Datanaut!
Sean
Community Champion
Community Champion

@mbailey test with hardcoding your number like this...

 

Message-Filter = IF ( 1589 - COUNTROWS(DMTA_Service_Report)>0,"Filtered","No Filter")

what do you get with the above?

Vvelarde
Community Champion
Community Champion

@mbailey

 

If you have a filter (Report Filter, Page Filter or anything similar) it won't work.

 

For now; Other alternative is use IsFiltered Function but you need to put each column of yours slicers. 

 

Let me think if found other way.

 

 




Lima - Peru
Sean
Community Champion
Community Champion

@mbailey make sure you don't have ANYthing else pre-selected or Page filters, Report Filters, anything else already selected!

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.