Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
DanZloo
Helper I
Helper I

Create a Card that hides or shows values depending on the filter selection

Hi!

I would like to create a card that is dependent of a filter selection.

So, i am using conditional formating to solve this issue. I have a date visual that looks like this:

Date Visual v2 = IF(ISFILTERED('MTD/QTD/YTD Selection_v2'),"MTD "&MAX('MTD/QTD/YTD Selection_v2'[YEAR/MONTH]),(" "))

This works fine. Although when i am not selecting MTD or PMTD i want the text to be white or blank and therfore i created this measure to conditional format with:

Make Transparent Measure = IF(SELECTEDVALUE('MTD/QTD/YTD Selection_v2'[Selection]) = "MTD" && "PMTD", "#000000",
IF(SELECTEDVALUE('MTD/QTD/YTD Selection_v2'[Selection]) = "MTD" || "PMTD", "#000000","#FFFFFF" ))

with the above mentioned measure i get an error:
"Cannot convert value 'PMTD' of time text to type True/False" and i guess that is because i have 2 values instead of one.

Is there a way to bypass this or use another dax-format to get the expected result?

Kind Regards
D.Z

1 ACCEPTED SOLUTION
v-rongtiep-msft
Community Support
Community Support

Hi @DanZloo ,

Please have a try.

Date Visual v2 =
IF (
    SELECTEDVALUE ( 'MTD/QTD/YTD Selection_v2' ) <> BLANK (),
    "MTD " & MAX ( 'MTD/QTD/YTD Selection_v2'[YEAR/MONTH] ),
    ( " " )
)

 

If it does not help, please provide more details with your desired output and pbix file without  priavcy information.

 

Best Regards

Community Support Team _ Polly

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-rongtiep-msft
Community Support
Community Support

Hi @DanZloo ,

Please have a try.

Date Visual v2 =
IF (
    SELECTEDVALUE ( 'MTD/QTD/YTD Selection_v2' ) <> BLANK (),
    "MTD " & MAX ( 'MTD/QTD/YTD Selection_v2'[YEAR/MONTH] ),
    ( " " )
)

 

If it does not help, please provide more details with your desired output and pbix file without  priavcy information.

 

Best Regards

Community Support Team _ Polly

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

A similar solution to this is what i am after:

IF (
SELECTEDVALUE ( 'MTD/QTD/YTD Selection_v2'[Selection] ) = "MTD" && "PMTD" ,
"MTD " & MAX ( 'MTD/QTD/YTD Selection_v2'[YEAR/MONTH] ),
(" ")
)
Becuse that calculation gives me an error.
"Cannot convert 'PMTD' of type Text to type True/False

Hi @v-rongtiep-msft amd thank you for your answer!

Unfortunately that is not quite what i am after. That works fine if i have one value!

But what if i filter MTD & PMTD then the card will become blank

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors