cancel
Showing results 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

Anonymous
Not applicable

## Representing a grouped variable in an ungrouped visual

Hi all,

I am trying to represent the total rain of different events along the time axis (as per image and table at the bottom). So when an event start, it should represent the total rainfall of that event until the event ends.

I tried with the dash function below but I am not getting the desires results. Would anyone have any sugestions on what I am doing wrong?

Many thanks,

Measure =
Var MinTime = minx(addcolumns(summarize(TblRG,TblRG[Event Group]),"MinT",calculate(min(TblRG[Time]),all(TblRG[Time]))),[MinT])

Var MaxTime = maxx(addcolumns(summarize(TblRG,TblRG[Event Group]),"MaxT",calculate(max(TblRG[Time]),all(TblRG[Time]))),[MaxT])
return

CALCULATE (SUM
(TblRG[Rain mm]),
FILTER (
all(TblRG[Time]),
TblRG[Time] >= MinTime
&& TblRG[Time] <=MaxTime
)
)
return

CALCULATE (SUM
(TblRG[Rain mm]),
FILTER (
all(TblRG[Time]),
TblRG[Time] >= MinTime
&& TblRG[Time] <=MaxTime
)
)

 Time Rain mm Event Group 1 1 1 2 2 1 3 1 1 4 0 0 5 0 0 6 1 2 7 4 2 8 2 2 9 1 2 10 0 0 11 0 0 12 0 0 13 0 0 14 0 0

1 ACCEPTED SOLUTION
Super User

@Anonymous - If I understand this correctly, try this measure:

``````Measure =
VAR __EventGroup = MAX([EventGroup])
RETURN
SUMX(FILTER(ALL('Table'),[Event Group]=__EventGroup),[Rain mm])``````

See the attached PBIX below sig, Table (20), Measure 20.

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
2 REPLIES 2
Super User

@Anonymous , You can have new column like

Column = maxX(filter(Allselected(Table), Table[Event Group] =earlier(Table[Event Group])),Table[Rain])

or measure like

measure = calculate(max(Table[Rain]), allexcept(Table, Table[Event Group]))

or

measure = calculate(max(Table[Rain]), filter(Allselected(Table), Table[Event Group] =max(Table[Event Group])))

Super User

@Anonymous - If I understand this correctly, try this measure:

``````Measure =
VAR __EventGroup = MAX([EventGroup])
RETURN
SUMX(FILTER(ALL('Table'),[Event Group]=__EventGroup),[Rain mm])``````

See the attached PBIX below sig, Table (20), Measure 20.

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...