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
BenBlackswan
Helper V
Helper V

why can't I use string in IF statement?

I have the following measure

LastReviewDate =

    if(isblank(max(FactPerformanceRating[ReviewDate])),

        "No Review Yet",

        max(FactPerformanceRating[ReviewDate])

    )

ReviewDate is all date format.

 

When use this DAX, the card vis just show up as #,0.00, and it is not possible to format this measure as date.

Nietzsche_0-1713088352371.png

how can I change my DAX so that I can use string text inside the IF statement?

 

 

source, from DataCamp course case study: HR analystics in Power BI > 9.2 Analysing demographics

1 ACCEPTED SOLUTION
DataNinja777
Super User
Super User

Hi @BenBlackswan 

I think card visual only takes the output of the same data type.  So for example, in your original formula, the data type can be either date format or string format.  

 

If you tweak your formula like below, it will produce your required output.  

DataNinja777_0-1713092164854.png

DataNinja777_1-1713092204943.png

I also attach the pbix file for your reference.  

Best regards,

View solution in original post

2 REPLIES 2
BenBlackswan
Helper V
Helper V

oh yes you are night. 

 

The instruction did ask us to format it, but not in the code, but in the ribbon.

Nietzsche_0-1713094673861.png

 

DataNinja777
Super User
Super User

Hi @BenBlackswan 

I think card visual only takes the output of the same data type.  So for example, in your original formula, the data type can be either date format or string format.  

 

If you tweak your formula like below, it will produce your required output.  

DataNinja777_0-1713092164854.png

DataNinja777_1-1713092204943.png

I also attach the pbix file for your reference.  

Best regards,

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.