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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
KG12
New Member

Group some rows but not all

HI I want this table 

 

DateAccountValueType 
2023-10-052Xa
2023-10-052Ya
2023-10-052Zb
2023-10-052

F

b

 

To result when inserted into a matrix 

DateAccountValue (Measure)
2023-10-052X + Y
2023-10-052Z
2023-10-052F

 

So a measure that aggregates Value if type is a but not if type is b, the ALL rows shapp be shown for a specific date and account. 

1 REPLY 1
Jihwan_Kim
Super User
Super User

Hi, 

I am not sure if I understood your question correctly,  but I tried to solve this by adding index column into the table like below.

Please check the below picture and the attached pbix file if it suits your requirement.

 

Jihwan_Kim_0-1697474160048.png

 

 

Expected result measure: =
VAR _minindex =
    MINX (
        FILTER ( ALL ( Data ), Data[Type] = MAX ( Data[Type] ) ),
        CALCULATE ( SELECTEDVALUE ( Data[Index] ) )
    )
RETURN
    IF (
        MAX ( Data[Type] ) = "a",
        IF (
            MAX ( Data[Index] ) = _minindex,
            CALCULATE ( SUM ( Data[Value] ), FILTER ( ALL ( Data ), Data[Type] = "a" ) ),
            BLANK ()
        ),
        SUM ( Data[Value] )
    )

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 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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