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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
dokat
Post Prodigy
Post Prodigy

If function returning wrong value

Hi,

 

I have below if function where CY is equals to 12/31/2021 it should return Last Year. However formula returns 0. Anyone can help with what's causing this error?

 

Measure = if(('Tier'[CY])=DATE ( YEAR ( SELECTEDVALUE ('Tier'[CY]))-1, 12, 31 ),"Last Year",0)
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @dokat ,

 

Try the calculated column

Column = IF([CY]=DATE(2021,12,31),"Last Year","0")

vstephenmsft_0-1644917437640.png

 

Calculated columns and measures are different, please note.

What is the difference between Power BI calculated columns and measures? - TrueCue.

 

Best Regards,

Stephen Tao

 

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

5 REPLIES 5
TheoC
Super User
Super User

Hi @dokat 

 

Can you try:  

 

Measure = IF ( Table[Column] = DATE ( 2021, 12, 31 ) , 1 , 0 )

 

Hope it helps.

Theo

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

@TheoC Unfortunately it didnt work. And i'd like to make the lookup value to be dynamic rather than hard coded as it will change over time. '

 

Where formula equals to = 'Tier'{CY] (12/31/2021) Thanks

@dokat can you show me the screenshot of the error? 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

@TheoC  Please see below

dokat_0-1644470407292.png

 

Anonymous
Not applicable

Hi @dokat ,

 

Try the calculated column

Column = IF([CY]=DATE(2021,12,31),"Last Year","0")

vstephenmsft_0-1644917437640.png

 

Calculated columns and measures are different, please note.

What is the difference between Power BI calculated columns and measures? - TrueCue.

 

Best Regards,

Stephen Tao

 

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

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.