cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
StuartSmith Frequent Visitor
Frequent Visitor

Stop cards displaying first row of data table.

All, I have just been introduced to Power BI by my boss and he has given me a small project to do, to aid my learning in Power BI.  I have a map visual showing all our offices based on address.  I then have several cards underneath to display the office address and manager, with the cards being called "Address" and "Manager" when an office bubble is selected from the map and this works great.

 

BUT, if I select anywere in the map, not on an office bubble, the cards display the office details of the first row in the data table, which looks out of place.  How can i get the cards to stop displaying the first row of the data table if a map bubble isnt selected.

 

 

Thanks in advance,

 

* edited description to make more sense.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
StuartSmith Frequent Visitor
Frequent Visitor

Re: Stop cards displaying first row of data table.

Finally got it working, all by myself Smiley Happy  the code was right, just have to create a measure of each card and update the code slightly,  Anyway, all working and just need to test to make sure there are no odditities. 

 

{pats self on back}.

9 REPLIES 9
StuartSmith Frequent Visitor
Frequent Visitor

Re: Blank Card until filter is selected.

I should add, that I have searched the web and found various solutions, but i was either unable to translate to my setup or were not right for my requirements. 

Super User
Super User

Re: Blank Card until filter is selected.

Hi @StuartSmith

 

It can be done, You will have to play with the measure used in your card and add a condition with HASONEVALUE 

 


 


Did I answer your question correctly? Mark my answer as a solution!


Proud to be a Datanaut!  

StuartSmith Frequent Visitor
Frequent Visitor

Re: Stop cards displaying first row of data table.

Still struggling with this, and its the only thing outstanding to do, before I can show my boss.  Any further guidence would be greatly appreciated. 

Super User
Super User

Re: Stop cards displaying first row of data table.

Hi @StuartSmith

 

to provide a solution, we would need to see your file

 

 

 


 


Did I answer your question correctly? Mark my answer as a solution!


Proud to be a Datanaut!  

Community Support Team
Community Support Team

Re: Stop cards displaying first row of data table.

@StuartSmith,

 

See the post below as an example.

https://community.powerbi.com/t5/Desktop/Dynamic-text-based-on-slicer/m-p/214504#M94883

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
StuartSmith Frequent Visitor
Frequent Visitor

Re: Stop cards displaying first row of data table.

Thanks guys, I managed to splice together various solutions to get it so that if I select a bubble on the map it displays the approriate date in the card, and then if I select anywhere in the map (not on data bubble), the card is blank, so getting there.

 

The code to do that is: 

HQ_Measure = IF(ISFILTERED('Location Overview'[Address]) && HASONEVALUE('Location Overview'[Address]), LASTNONBLANK('Location Overview'[HQ], ""), "")
 
the trouble is I also have 3 slices on the page to also filter the results.  With one of the filters beign called "Country_Slicer".  When i use a slicer, it doesnt update the card and suspect I need an AND/OR part to the code, but cant get the correct format.  I have done lots of seaching, but cant find anything that helps.  How should my script look so it not only checks the map, but also the slicers.
StuartSmith Frequent Visitor
Frequent Visitor

Re: Stop cards displaying first row of data table.

Also, how would I get the "LASTNONBLANK" section to clear multiple columns and not just the "HQ" one.  I have tried various formats, but it either doesnt work or for some reason displays "False" on the HQ Card.

 

HQ_Measure = IF(ISFILTERED('Location Overview'[Address]) && HASONEVALUE('Location Overview'[Address]), LASTNONBLANK('Location Overview'[HQ], ""), "")

StuartSmith Frequent Visitor
Frequent Visitor

Re: Stop cards displaying first row of data table.

Nothing like a fresh weekend head to get the grey matter working, as slowly making progress, as I have now got the DAX code only displaying a value in a card if either a map data bubble is selected or a value is selected in a dropdown slicer.  Just one final issue in trying to get the code to apply to multiple cards.

 

This is the current code...

HQ_Measure = IF(ISFILTERED('Location Overview'[Address]) && HASONEVALUE('Location Overview'[Address]) || ISFILTERED('Location Overview'[Building Code]) && HASONEVALUE('Location Overview'[Building Code]), LASTNONBLANK('Location Overview'[HQ], ""), "")

 

How can I get multiple "LASTNONBLANK" values?  i beleive this is the "IF True" output value for the IF Statement.  Can you have multiple IF TRUE output values? if so, how.  I have tried various combination of "AND" and "&&" in different places, but no joy.

 

Thanks in advance,

 

 

 

Highlighted
StuartSmith Frequent Visitor
Frequent Visitor

Re: Stop cards displaying first row of data table.

Finally got it working, all by myself Smiley Happy  the code was right, just have to create a measure of each card and update the code slightly,  Anyway, all working and just need to test to make sure there are no odditities. 

 

{pats self on back}.