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
StuartSmith
Power Participant
Power Participant

More effective way to have blank card values

I have a report that currently have about 20 cards on it, showing various bits of data, but with the nature of "Cards", it always wants to show the first value of its respective column if there is no filtering.  I therefore have a measure for each card that looks like...

 

5G_in_Country_Measure = IF(ISFILTERED('Carrier Matrix'[Region]) && HASONEVALUE('Carrier Matrix'[Region]) || ISFILTERED('Carrier Matrix'[Country]) && HASONEVALUE('Carrier Matrix'[Country]) || ISFILTERED('Carrier Matrix'[Carrier]) && HASONEVALUE('Carrier Matrix'[Carrier]) || ISFILTERED('Carrier Matrix'[OData__2_Contractstatus/planning]) && HASONEVALUE('Carrier Matrix'[OData__2_Contractstatus/planning]), IF(COUNT('Carrier Matrix'[Key]) =1, LASTNONBLANK('Carrier Matrix'[OData_5GAvailable]," "), " "), " ")
 
That looks at each filter and if the filters are blank, the card will be blank, but if there is only one record (IF(COUNT('Carrier Matrix'[Key]) =1), that record is displayed in the card, but obviously, when the report loads, it have to run lots and lots of measures even before the data is displayed and the loading time of the report is slow.  Until "Cards" support empties, has anyone got a for effective ways of having cards show nothing unless filtering is active?
 
Thanks in advance,
1 ACCEPTED SOLUTION

I was thinking about this last night, and a way to reduce the code to speed up the running of the code...


Country_Measure = IF(ISFILTERED('Carrier Matrix'[Region]) && HASONEVALUE('Carrier Matrix'[Region]) || ISFILTERED('Carrier Matrix'[Country]) && HASONEVALUE('Carrier Matrix'[Country]) || ISFILTERED('Carrier Matrix'[Carrier]) && HASONEVALUE('Carrier Matrix'[Carrier]) || ISFILTERED('Carrier Matrix'[OData__2_Contractstatus/planning]) && HASONEVALUE('Carrier Matrix'[OData__2_Contractstatus/planning]), IF(COUNT('Carrier Matrix'[Key]) =1, LASTNONBLANK('Carrier Matrix'[Country]," "), " "), " ")

 

and thinking about what the code does, it checks to see if any filters are applied and then only displays data in a card if there is only 1 row.  Therefore, I could remove the checking of filter steps and simply count the number of rows, reducing the overhead processing.

 

Country_Measure Test= IF(COUNT('Carrier Matrix'[Key]) =1, LASTNONBLANK('Carrier Matrix'[Country]," "), " ")

 

Does anyone see any issue with the above?  I have tested and seems to work.

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@StuartSmith , I think you have followed this way only. The only thing is you have parenthesis on && statement 

(ISFILTERED('Carrier Matrix'[Region]) && HASONEVALUE('Carrier Matrix'[Region])) || ()

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

I was thinking about this last night, and a way to reduce the code to speed up the running of the code...


Country_Measure = IF(ISFILTERED('Carrier Matrix'[Region]) && HASONEVALUE('Carrier Matrix'[Region]) || ISFILTERED('Carrier Matrix'[Country]) && HASONEVALUE('Carrier Matrix'[Country]) || ISFILTERED('Carrier Matrix'[Carrier]) && HASONEVALUE('Carrier Matrix'[Carrier]) || ISFILTERED('Carrier Matrix'[OData__2_Contractstatus/planning]) && HASONEVALUE('Carrier Matrix'[OData__2_Contractstatus/planning]), IF(COUNT('Carrier Matrix'[Key]) =1, LASTNONBLANK('Carrier Matrix'[Country]," "), " "), " ")

 

and thinking about what the code does, it checks to see if any filters are applied and then only displays data in a card if there is only 1 row.  Therefore, I could remove the checking of filter steps and simply count the number of rows, reducing the overhead processing.

 

Country_Measure Test= IF(COUNT('Carrier Matrix'[Key]) =1, LASTNONBLANK('Carrier Matrix'[Country]," "), " ")

 

Does anyone see any issue with the above?  I have tested and seems to work.

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

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.