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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
asofiacgraca
Helper I
Helper I

How to iteratively group results in PowerBI

Hey 🙂

I am having some troubles writting a DAX querie for my purpose.

I have a table with the following columns: IDofPurchase, Supplier, Fraccionated. In the fraccionated column i wrote the code in order for it to return the value "Close" if purchase orders have the same supplier and "Okay" if it doesnt.

Now, i need another column where if the value of Fraccionated is "Close", it groups de purchase orders with the same supplier. For example:

asofiacgraca_0-1685454970079.png

I want to create the column Group. Can anyone help me, please?

 

Thanks 🙂

1 ACCEPTED SOLUTION
v-yanjiang-msft
Community Support
Community Support

Hi @asofiacgraca ,

According to your description, here's my solution. Create a measure.

Column =
VAR _Rank =
    RANKX (
        FILTER ( 'Table', 'Table'[Fraccionated] = "Close" ),
        'Table'[Supplier],
        ,
        ASC,
        DENSE
    )
RETURN
    IF ( [Fraccionated] = "Okay", "Okay", "Group" & _Rank )

Get the correct result:

vyanjiangmsft_0-1685603935110.png

I attach my sample below for your reference.

 

Best regards,

Community Support Team_yanjiang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

2 REPLIES 2
v-yanjiang-msft
Community Support
Community Support

Hi @asofiacgraca ,

According to your description, here's my solution. Create a measure.

Column =
VAR _Rank =
    RANKX (
        FILTER ( 'Table', 'Table'[Fraccionated] = "Close" ),
        'Table'[Supplier],
        ,
        ASC,
        DENSE
    )
RETURN
    IF ( [Fraccionated] = "Okay", "Okay", "Group" & _Rank )

Get the correct result:

vyanjiangmsft_0-1685603935110.png

I attach my sample below for your reference.

 

Best regards,

Community Support Team_yanjiang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Hey, that's perfect!

 

Thanks 🙂

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors