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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
ovonel
Post Prodigy
Post Prodigy

get a MAX of a group and still be able to filter?

I have  a Fact Revenue, and I am trying to get the MAX of a group

 

I want to group  revenue by Customer and Sector… and then pick the MAX for each Customer

 

(I can do this visually when I put in a Matrix, Customer, Sector and Revenue).

 

 

The below measures do the work for me

 

SubTotalCustomerSec =

CALCULATE ( SUM(FactRevenue[Revenue]), ALLEXCEPT ( FactRevenue, 'Customer'[Customer], 'Sector'[Sector] ) )

 

MaxSecerCustomer =

MAXX ( ALLEXCEPT ( FactRevenue, 'Customer'[Customer] ), [SubTotalCustomerSec] )

 

 

 

 

The problem is that I can’t filter… I want to achieve the above but still be able to select a specific Customer or pick a specific value for a higher level than customer…

 

If I select any specific Customer or ParentCustomer and add my above measures, the matrix brings all the rows for all ParentCustomers...

1 ACCEPTED SOLUTION
mahoneypat
Employee
Employee

My bad on copying from your expressions incorrectly.  I meant to write this.

 

Max Measure =
VAR summary =
    ADDCOLUMNS (
        SUMMARIZE ( FactRevenue, 'Customer'[Customer], Sector[Sector] ),
        "cTotal"CALCULATE ( SUM ( FactRevenue[Revenue] ) )
    )
RETURN
    MAXX ( summary, [cTotal] )

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

3 REPLIES 3
mahoneypat
Employee
Employee

My bad on copying from your expressions incorrectly.  I meant to write this.

 

Max Measure =
VAR summary =
    ADDCOLUMNS (
        SUMMARIZE ( FactRevenue, 'Customer'[Customer], Sector[Sector] ),
        "cTotal"CALCULATE ( SUM ( FactRevenue[Revenue] ) )
    )
RETURN
    MAXX ( summary, [cTotal] )

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


mahoneypat
Employee
Employee

You could try an approach like this.

 

Max Measure =
VAR summary =
    ADDCOLUMNS (
        SUMMARIZE ( FactRevenue, 'Customer'[Customer], [SubTotalCustomerSec] ),
        "cTotal"CALCULATE ( SUM ( FactRevenue[Revenue] ) )
    )
RETURN
    MAXX ( summary, [cTotal] )

 

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


@mahoneypat thanks for the ansewr but I can't write         SUMMARIZE ( FactRevenue, 'Customer'[Customer], [SubTotalCustomerSec] ),

since SUMMARIZE doesn't accept the measure.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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