cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Post Prodigy
Post Prodigy

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
Super User IV
Super User IV

@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])) || ()



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

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

Helpful resources

Announcements
secondImage

Experience what’s next for Power BI

Join us for an in-depth look at the new Power BI features and capabilities at the free Microsoft Business Applications Launch Event.

secondImage

Power BI Women

Join our monthly meetings and learning sessions.

secondImage

Congratulations!

We are excited to announce the Power BI Super Users!

secondImage

The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors