cancel
Showing results for
Did you mean:

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

Helper II

## Return Week number of Max Events

Hi, need help with a DAX Query I want to retune which week(s) the max hours occurs not all weeks for each course?

Weekly Course Hours Max = SUMMARIZECOLUMNS('Weekly Course Hours'[Course (Weekly)],'Weekly Course Hours'[Week No],"Max Week" , MAX('Weekly Course Hours'[Hours Per Week]))

1 ACCEPTED SOLUTION
Super User

or you plot the course column with two measures like:

``_WeekMax = MAX(data[WeekMax])``
``````_WeekNo =
MAXX(
TOPN(
1,
data,
data[WeekMax]
),
data[WeekNo]
)``````

it worked like:

4 REPLIES 4
Helper II

Thanks, it is common thet the max week occurs more then once, is there a war to expemf to reuurm them all

i.e. Course A may have a max hours in week 3,7 and week 10.

Helper II

Hi, Thanks, nearly right

It is returning the hours for the max week, but it is returning the last (Max) value for Week No. and not the weeks this values occur on i,e, the first course has 30 weeks of data, so it is returning 30 and not weeks 11, 12, 14 14 & 15

Super User

hi @Garbo62

not sure if i fully get you, supposing you have a data table like:

try to create a calculated table like:

``````Table =
VALUES(data[course]),
"WeekMax",
CALCULATE(MAX(data[WeekMax]))
),
"WeekNo",
CALCULATE(MAX(data[WeekNo]))
)``````

it worked like:

Super User

or you plot the course column with two measures like:

``_WeekMax = MAX(data[WeekMax])``
``````_WeekNo =
MAXX(
TOPN(
1,
data,
data[WeekMax]
),
data[WeekNo]
)``````

it worked like:

Announcements

#### 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 Monthly Update - June 2024

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

#### New forum boards available in Real-Time Intelligence.

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

Top Solution Authors
Top Kudoed Authors