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
Anonymous
Not applicable

If Then with two arguments(columns) then return fail or pass

Greetings,

I need to perform a DAX calculation that looks at columns C and D and if they are over a certain number then a return colum should say 'Fail' otherwise 'Pass". The problem I am having is that my report keep on suggesting key measures instead of the actual table and column. When I just type the table with the colum i.e. 'Table'['results'] or 'Table'[results]. The program doesnt like it and gives me an error. I thought it was because the C and D columns were sum but that is not the case. Thanks in advance.

1 ACCEPTED SOLUTION
PhilipTreacy
Super User
Super User

Hi @Anonymous 

 

Download sample PBIX file

 

Please show us your data and the DAX you are trying to write.  Really hard to see the issue without them.

That said, I'm guessing that you are might be trying to write a measure and DAX is telling you that you need to provide an aggregation for the column.

Also, is it a Fail if both C and D are over a certain number, or is it just one or the other over a certain number?

If you are writing DAX to create a column it could look like this which produces Fail if both C and D are over 20.  Adjust as required.

Result = IF([C] > 20 && [D] > 20, "Fail", "Pass")

pf2.png

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Thanks again.

 

v-stephen-msft
Community Support
Community Support

Hi @Anonymous ,

 

If it is to calculate the sum of metrics, you can use the SUMX function.

SUMX(<table>, <measure>)  

 

 

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.

PhilipTreacy
Super User
Super User

Hi @Anonymous 

 

Download sample PBIX file

 

Please show us your data and the DAX you are trying to write.  Really hard to see the issue without them.

That said, I'm guessing that you are might be trying to write a measure and DAX is telling you that you need to provide an aggregation for the column.

Also, is it a Fail if both C and D are over a certain number, or is it just one or the other over a certain number?

If you are writing DAX to create a column it could look like this which produces Fail if both C and D are over 20.  Adjust as required.

Result = IF([C] > 20 && [D] > 20, "Fail", "Pass")

pf2.png

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


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.