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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Nawaz
Regular Visitor

Aggregate data at granular level and assign it to high level

I'm a new PowerBI user, so please excuse if this is silly question

 

I want to get the highest sales for each category, and at the same time i don't want to show subcategory in the view.

 

In Tableau this can be achieved using the mix of Include and Fixed Level of Detail functions. Is there something similar in Power BI ?

 

Sample Data: 

CategorySubcategorySales
ElectronicsLaptopA325
ElectronicsLaptopB200
ElectronicsLaptopC110
FurnitureChairs30
FurnitureChairs50

 

Exected Output:

CategorySales
Electronics350
Furniture50

 

Thanks,

Nawaz

1 ACCEPTED SOLUTION

Hi @Nawaz ,

@TomMartens Thanks for your concern about this case!

And @Nawaz , you can use these DAXs to achieve this:

_SUM = 
CALCULATE(
    SUM('Table'[Sales]),
    ALLEXCEPT('Table', 'Table'[Sub-Category])
)
_MAX = MAXX('Table', [_SUM])

Then put Category and _MAX into the table visual:

vjunyantmsft_0-1715758107908.png


Or if you can use Power Query, you can also achieve this by using Group By twice:
First:

vjunyantmsft_2-1715758220774.png

Then:

vjunyantmsft_3-1715758298258.png


Best Regards,
Dino Tao
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

3 REPLIES 3
Nawaz
Regular Visitor

Hi Tom, thanks for the response. I aplogize for not providing the enough data to get the desired result.

 

Bascially, i would like to calculate the sales at sub category level and assign the highest sales to catergoy without mentioning the sub category in the view as shown below in expected output.

 

Nawaz_0-1715692338938.png


Thanks,

Nawaz

Hi @Nawaz ,

@TomMartens Thanks for your concern about this case!

And @Nawaz , you can use these DAXs to achieve this:

_SUM = 
CALCULATE(
    SUM('Table'[Sales]),
    ALLEXCEPT('Table', 'Table'[Sub-Category])
)
_MAX = MAXX('Table', [_SUM])

Then put Category and _MAX into the table visual:

vjunyantmsft_0-1715758107908.png


Or if you can use Power Query, you can also achieve this by using Group By twice:
First:

vjunyantmsft_2-1715758220774.png

Then:

vjunyantmsft_3-1715758298258.png


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

TomMartens
Super User
Super User

Hey @Nawaz ,

 

create a table visual, add the category and the sales column, finally change the aggregation of Sales column from Sum to Maximum:

image.png

Hopefully, this provides what you are looking for.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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