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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
nsaray
Helper II
Helper II

DAX Help - Determine value using occurrence on sub-set of data

I have a set of data which looks like the below and I need to determine whether a transaction is Fully Auto, Partially Auto or Manual.

 

The rule is:

- If a Transaction has User="Auto" for all 3 statuses, then "Fully Auto"

- If a Transaction has User is not "Auto" for all 3 statuses, then "Manual"

- If a Transaction has User = "Auto" for 1 or 2 statuses, then "Partially Auto"

 

How could I write this DAX measure?

 

Data

TransactionStatusUser
Transaction AStatus AAuto
Transaction AStatus BAuto
Transaction AStatus CAuto
Transaction BStatus AAuto
Transaction BStatus BUser 1
Transaction BStatus CUser 2
Transaction CStatus AUser 1
Transaction CStatus BUser 2
Transaction CStatucs CUser 3

 

Final Output

TransactionOutcome
Transaction AFully Auto
Transaction BPartially Auto
Transaction CManual
2 REPLIES 2
CNENFRNL
Community Champion
Community Champion

Outcome = 
SWITCH (
    TRUE (),
    ISEMPTY ( CALCULATETABLE ( Data, Data[User] = "Auto" ) ), "Manual",
    COUNTROWS ( VALUES ( 'Data'[User] ) ) = 1, "Fully Auto",
    "Partially Auto"
)

Screenshot 2021-06-13 204119.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Jihwan_Kim
Super User
Super User

hi, @nsaray 

I am not 100% sure if I understood your question correctly, but please check the below picture and the sample pbix file's link down below. It is for creating a measure.

 

Picture1.png

 

Outcome Measure =
IF (
ISFILTERED ( Data[Transaction] ),
SWITCH (
TRUE (),
COUNTROWS ( VALUES ( Data[Status] ) ) = 3
&& CALCULATE ( COUNTROWS ( Data ), Data[User] = "Auto" ) = 3, "Fully Auto",
COUNTROWS ( VALUES ( Data[Status] ) ) = 3
&& CALCULATE ( COUNTROWS ( Data ), Data[User] = "Auto" ) > 0, "Partially Auto",
"Manual"
)
)

 

 

https://www.dropbox.com/s/kryxg2jq7dsql2d/nsaray.pbix?dl=0 

 

 

Hi, My name is Jihwan Kim.

 

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

 

Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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