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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

Power BI Dynamic Grouping

I've a requirement on a Table to summarise the data based on below scenarios: The Table 1 is the existing, the Table 2 is what is expecting.

Table 1

Item#ItemNameReasonCatogeryLostSales
28783Item 1Orders waitingcat1$54
28783Item 1Short Term Out Of Stockcat1$13
28844Item 2Long Term Out of Stockcat 2$78
29193Item 3Orders waitingcat 3$15
30151Item 4Discontinuecat 4$302
30311Item 5Not applicablecat 5$64
30663Item 6Orders waitingcat 6$418

 

Table 2

Item#ItemNameReasonCatogeryLostSales
28783Item 1Mixedcat1$68
28844Item 2Long Term Out of Stockcat 2$78
29193Item 3Orders waitingcat 3$15
30151Item 4Discontinuecat 4$302
30311Item 5Not applicablecat 5$64
30663Item 6Orders waitingcat 6$418

 

 Any one help on this achieving the Table 2.

 

 

1 ACCEPTED SOLUTION
saykasku
Resolver I
Resolver I

Hi,

 

You need to create measure like this:

 
Reason_new = 
var _Reason = LASTNONBLANK(Arkusz1[Reason];1)
RETURN
IF(
    CALCULATE( DISTINCTCOUNT(Arkusz1[Reason]) ;
    all(Arkusz1[Reason])) > 1
    ;"Mixed"
    ;_Reason
    )

This is solution for you.reason.PNG

 

 

 

View solution in original post

4 REPLIES 4
saykasku
Resolver I
Resolver I

Hi,

 

You need to create measure like this:

 
Reason_new = 
var _Reason = LASTNONBLANK(Arkusz1[Reason];1)
RETURN
IF(
    CALCULATE( DISTINCTCOUNT(Arkusz1[Reason]) ;
    all(Arkusz1[Reason])) > 1
    ;"Mixed"
    ;_Reason
    )

This is solution for you.reason.PNG

 

 

 

I'm not sure what behaviour you want when filters are applied via slicers that result in only 1 reason being present, but just note that @saykasku 's approach will always return "Mixed" regardless of any current filters, while the approach using SELECTEDVALUE() function will switch to showing the single reason if the current filter context eliminates the multiple reasons. Both approaches are valid, it just depends on what your requirements are.

 

eg

 

201908 mixed reason.gif

 

 

Anonymous
Not applicable

Is there some way to have something like this that will instead solo out Columns along with their supporting rows? I also need a way to group 4 columns without changing the data just want power BI to recognize that these 4 columns are all under 1 main name

d_gosbell
Super User
Super User

The only way I can think of for doing this would be to create a measure which you would use in place of the "Reason" attribute.

 

eg.

 

Reason Text = SELECTEDVALUE( 'Table 1'[Reason], "Mixed")

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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