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! Request now

Reply
rizkus
Frequent Visitor

Need Help with DAX Formula to combine rows

Hi All,

 

I am looking for help in regards to the data i have. currently i have this type of data

 

IMG_1298.jpeg

 

And then i have created a rank to categorize the order of the segment, as below

IMG_1299.jpeg

 

the outcome expected is a table, showing only the highest rank (in this case, segment B), but the Value Measure is added altogether:

IMG_1300.jpeg

 

I would also like to have it able to be filtered, so for example, if i filter segment A, it doesnt show any data anymore

 

Need your help and appreciate all the help, thanks!

5 REPLIES 5
v-sgandrathi
Community Support
Community Support

Hi @rizkus,

 

Just wanted to follow up and confirm that everything has been going well on this. Please let me know if there’s anything from our end.
Please feel free to reach out Microsoft fabric community forum.

 

Thankyou.

v-sgandrathi
Community Support
Community Support

Hi @rizkus,

 

Just wanted to follow up and confirm that everything has been going well on this. Please let me know if there’s anything from our end.
Please feel free to reach out Microsoft fabric community forum.

 

Thank you.

v-sgandrathi
Community Support
Community Support

Hi @rizkus,

 

Hi @op,

 

I reviewed your requirement and tested it using @DataNinja777  sample PBIX file. When I selected Segment A in the filter, the visual displayed blank values. This behavior is expected because the DAX measure is designed to return results only for the top ranked segment (Rank = 1) within each ID. In your dataset, Segment A does not hold the highest rank, so the condition in the formula . IF ( _currentSegment = _topSegment, _totalForID ) evaluates to blank for that segment. Essentially, the measure aggregates and displays values only for the segment with the top rank, while all other lower ranked segments show no results when filtered.

 Thank you and continue using Microsoft Fabric Community Forum
Have a nice day ahead.

DataNinja777
Super User
Super User

Hi @rizkus ,

 

You can produce your required output by writing a measure like below:

Combined Value = 
VAR _totalForID =
    CALCULATE (
        SUM ( Data[Value Measure] ),
        ALLEXCEPT ( Data, Data[ID] )
    )
VAR _topSegment =
    CALCULATE (
        SELECTEDVALUE ( SegmentRank[Segment] ),
        SegmentRank[Rank] = 1
    )
VAR _currentSegment =
    SELECTEDVALUE ( Data[Segment] )
RETURN
    IF (
        _currentSegment = _topSegment,
        _totalForID
    )

Then, you can put the measure along with the fields in the fact and dimension tables in a table visual as shown below:

DataNinja777_0-1761833483515.png

I am attaching the pbix file for your reference.

 

Hi,

 

thanks so much! quick question, if i filter the segment as "A", will it show?

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.