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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
yuvarajin
Regular Visitor

How to group by using categorial values using some business logics

Dear Friends,

 

i am trying to achieve the results by grouping the decision of Episode ID using some business logic, can anyone help me on this?

 

Please refer below image for data set and expectation with Logics. KIndly ask me for more questions. 

 

yuvarajin_0-1634570883477.png

Thanks,

Yuvi

2 ACCEPTED SOLUTIONS
ChrisMendoza
Resident Rockstar
Resident Rockstar

@yuvarajin -

I attempted using Power Query.

image.png

if Table.MatchesAllRows([Grouped], each [Decision] = "Approved") then "Approved" else if Table.MatchesAllRows([Grouped], each [Decision] = "Denied") then "Denied" else if Table.MatchesAllRows([Grouped], each [Decision] = "Partially denied") then "Partially denied" else if Table.MatchesAnyRows([Grouped], each [Decision] = "Pending") then "Pending" else "Partially denied"





Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



View solution in original post

Sorry. Try COUNTROWS ( DecisionList ) = 1 instead.

View solution in original post

6 REPLIES 6
yuvarajin
Regular Visitor

Thanks much for the solution. It works as expected. Thanks a ton again 🙂

ChrisMendoza
Resident Rockstar
Resident Rockstar

@yuvarajin -

I attempted using Power Query.

image.png

if Table.MatchesAllRows([Grouped], each [Decision] = "Approved") then "Approved" else if Table.MatchesAllRows([Grouped], each [Decision] = "Denied") then "Denied" else if Table.MatchesAllRows([Grouped], each [Decision] = "Partially denied") then "Partially denied" else if Table.MatchesAnyRows([Grouped], each [Decision] = "Pending") then "Pending" else "Partially denied"





Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



Thanks Chris for the quick solutioning and help. This is one of the cool technique i learned from you power query:) i appreciate your support and help on this. Have a good day!

AlexisOlson
Super User
Super User

How about this?

Overall Decision =
VAR DecisionList =
    CALCULATETABLE (
        VALUES ( Table1[Decision] ),
        ALLEXCEPT ( Table1, Table1[Episode ID] )
    )
RETURN
    IF (
        HASONEVALUE ( DecisionList ),
        DecisionList,
        IF ( "Pending" IN DecisionList, "Pending", "Partially denied" )
    )

 

Thanks Alex for your solutioning. I tried the code and got the error as "The HASONEVALUE function expects a column reference expression for argument '1', but a table expression was used.", can you please help me on that ? Screen shot below for your reference.

yuvarajin_0-1634625912933.png

 

Sorry. Try COUNTROWS ( DecisionList ) = 1 instead.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors