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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anil2264
Helper I
Helper I

If Condition in Column & Measure

Dear All,

 

Please guide me while i am trying to make if condition in measures then why i am not able to pick the columns of my table, it is only showing the already created other measures in dax.

 

Please guide.

1 ACCEPTED SOLUTION
Anil2264
Helper I
Helper I

Thanks @goncalo

could you also please explain why columns are not picking up in if measure

View solution in original post

3 REPLIES 3
Anil2264
Helper I
Helper I

Thanks @goncalo

could you also please explain why columns are not picking up in if measure

Hello there @Anil2264 ! That happens because a measure can only have a single (scalar) value and not a hole column or table. That is why you need to either provide a scalar value or (as I did in the measure above) store the single value in a variable to then use in the RETURN. Variables are always a good choice to implement when creating expressions with filters since the variables are evaluated outside the filters your RETURN expression applies.

 

You can refer to this link for further help.

 

Hope this answer solves your problem! If you need any additional help please @ me in your reply.
If my reply provided you with a solution, pleased consider marking it as a solution ✔️ or giving it a kudoe 👍
Thanks!

You can also check out my LinkedIn!

Best regards,
Gonçalo Geraldes

goncalogeraldes
Super User
Super User

Hello there @Anil2264 ! You can structure you IF statement like so:

IF = 
var _column = SELECTEDVALUE(Table[Column Name])

return
IF(
_column = condition,
value if true,
value if false (optional)
)

Hope this answer solves your problem! If you need any additional help please @ me in your reply.
If my reply provided you with a solution, pleased mark it as a solution ✔️ or give it a kudoe 👍
Thanks!

You can also check out my LinkedIn!

Best regards,
Gonçalo Geraldes

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors