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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
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
    )
)

 

 

TimeRain mmEvent Group
111
221
311
400
500
612
742
822
912
1000
1100
1200
1300
1400
 
 

Capture.PNG

 

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
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.

Greg_Deckler_0-1599397419312.png

 


@ 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!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
amitchandak
Super User
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])))

 

Greg_Deckler
Super User
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.

Greg_Deckler_0-1599397419312.png

 


@ 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!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.