Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now
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.
Solved! Go to Solution.
Finally got it working, all by myself 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}.
Thank you. It was just what I need it. 😁
Glad it helped. Its nice to be able to help someone , instead of people always helping me. I actually improved on the code as found it cumbersom so slow to run on multiple cards, so i figured I could reduce the measure from...
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]," "), " "), " ")
down to
Country_Measure Test= IF(COUNT('Carrier Matrix'[Key]) =1, LASTNONBLANK('Carrier Matrix'[Country]," "), " ")
So instead of checking each slicer to see if it had been "filtered" or "has one value", i scrapped that part and just counted the table and if the table only had one row, it displayed that row, otherwise, remained blank. Hopefully this will help.
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:
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], ""), "")
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,
Finally got it working, all by myself 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}.
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.
See the post below as an example.
https://community.powerbi.com/t5/Desktop/Dynamic-text-based-on-slicer/m-p/214504#M94883
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!
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!
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.
Check out the October 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
113 | |
91 | |
84 | |
76 | |
65 |
User | Count |
---|---|
145 | |
109 | |
109 | |
102 | |
96 |