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
ketan10
Resolver I
Resolver I

DAX Help Needed: Group values by transaction id and check class

I have a Table 1 using this I need to create a Table 2 as shown in the image below. I would appreciate any help with the logic on this to be done either using DAX or maybe in Tableau.  Thank you.

Note: If a transaction id has a class 'SP' then for that transaction id replace the class 'WSP' with 'SP' and then get the sum for that transaction id.


Screenshot (55).png

 

1 ACCEPTED SOLUTION

@ketan10

 

This Column for New Revenue

 

New Revenue =
CALCULATE (
    SUM ( TableName[Revenue] ),
    ALLEXCEPT ( TableName, TableName[Transaction ID] )
)

Regards
Zubair

Please try my custom visuals

View solution in original post

3 REPLIES 3
Zubair_Muhammad
Community Champion
Community Champion

HI @ketan10

 

Try this Calculated Column

 

New Class =
IF (
    CALCULATE (
        COUNTROWS ( TableName ),
        FILTER (
            ALLEXCEPT ( TableName, TableName[Transaction ID] ),
            TableName[Class] = "SP"
        )
    )
        >= 1,
    "SP",
    TableName[Class]
)

Regards
Zubair

Please try my custom visuals

@ketan10

 

This Column for New Revenue

 

New Revenue =
CALCULATE (
    SUM ( TableName[Revenue] ),
    ALLEXCEPT ( TableName, TableName[Transaction ID] )
)

Regards
Zubair

Please try my custom visuals

Hi @Zubair_Muhammad Thank you. This works perfect !

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.