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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Wayne_Wu888
Regular Visitor

max of an calculate sum by week

Hi,

 

I have a table as below, which defines the No. of a persons and his corresponding workload for each week, I want to get a card telling me the maximum value of man_week summarize by week_ending regardless the "No.". I have tried different ways but still can't get it.

can you help me?

thanks in advance.

 

No.Week_endingMan_week
16/4/20211
16/11/20211
16/18/20211
16/25/20211
17/2/20211
17/9/20211
17/16/20211
17/23/20211
17/30/20211
27/2/20211
27/9/20211
27/16/20211
27/23/20211
27/30/20211
66/4/20210.5
66/11/20210.5
66/18/20210.5
66/25/20210.5
67/2/20210.5
67/9/20210.5
67/16/20210.5
67/23/20210.5
67/30/20210.5
5 REPLIES 5
Anonymous
Not applicable

Hi @Wayne_Wu888 

 

I don't quite get this... Can you please use a really simple but representative table with raw data (something like above) and show us the calculation "in slow motion," so to speak, and the final result you're expecting? This will then hopefully make it clear how to write the DAX. Thanks.

 

In case of doubts... please read THIS.

Hi @Anonymous ,

 

Here I have a line chart showing the curve of man_week for each week, the maximum value is 61, now I want to make a card telling me the number of "61" directly.

can you help?

 

 

man_week.jpg

Anonymous
Not applicable

One of the following will do what you want:

 

 

[Total Manhours] = sum( T[Man_week] )

// This one gives you the max manhours
// w.r.t. the selected people and 
// selected weeks.
[Max Manhours] =
CALCULATE(
    MAXX(
        SUMMARIZE(
            T,
            T[No.],
            T[Week_ending]
        ),
        [Total Manhours]
    ),
    ALLSELECTED( T )
)

// or

// This one gives you the max manhours
// w.r.t. the total for all selected
// people across the selected weeks.
[Max Manhours] =
CALCULATE(
    MAXX(
        DISTINCT( T[Week_ending] ),
        [Total Manhours]
    ),
    ALLSELECTED( T )
)

 

CNENFRNL
Community Champion
Community Champion

@Wayne_Wu888 , for you reference,

Screenshot 2021-04-20 095620.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Hi @CNENFRNL,

 

Thanks for help, unfortunately that's not what i'm looking for.

actually i want to get the maxium value of summarize of Man_week by week_ending regardless the No., I have done this but it doesn't work properply. 

 

 

Peak Work_load =
VAR work_load =
SUMMARIZE(
'table',
'table'[Man_week],
"SUM work_load",SUM('table'[Man_week])
)
VAR Peak_work_load = MAXX(Work_load,[SUM Work_load])
RETURN
MAXX(FILTER(work_load,[SUM work_load] = Peak_work_load),'table'[Man_week])

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors