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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.