cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper II
Helper II

Cumulative Max Days

Greetings!

I am having trouble getting Cumulative Max days.

To calculate the same I have used following measure:

 
Cumulative Max Days = CALCULATE(MAX(SN[DaysTillToday]), FILTER(ALL ('Dates'), 'Dates'[Date] <= MAX('Dates'[Date])))

This gives me Max days but not the cumulative result.

 

Screenshot.png

I have uploaded PBIX & Excel sample data file for reference

https://drive.google.com/drive/folders/1m3uGRUPN28hqKPab2oYSmzO91z9t0BT3?usp=sharing 

 

Looking forward for a quick guidance please.

Thanks & best regards,

PG

2 ACCEPTED SOLUTIONS

@pankajj

I haven't exactly got what you're trying to do, but this measure will give you what you need

Cumulative Max Days = 

CALCULATE(
    COUNT(Dates[Date]),
    FILTER(
        ALLSELECTED(Dates),
        Dates[Date] < MAX(Dates[Date] )
    )
)

Fowmy_0-1600717034861.png

________________________

If my answer was helpful, consider Accepting it as the solution to help other members find it

Click the Thumbs-Up icon if you like this answer 🙂

Youtube Linkedin



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Website   YouTube    LinkedIn

View solution in original post

@Fowmy

Thanks a ton for your kind help. It worked perfectly with the sample file i shared.

In the meantime i created following measures to get the desired result in my existing data.

Open =
Was
(dates[Date])
RETURN
calculate(
CALCULATE(count(SN[ID])+0,
SN,
SN[Created]<=d
),
crossfilter(SN[Created],Dates[Date],None)
)

OLDEST_Open_Date =
Was
d - MAX (Dates[Date])
RETURN
CALCULATE(
FORMAT(CALCULATE(MIN(SN[Created]),
SN,
SN[Created]<=d),
"Short Date"
),
CROSSFILTER(SN[Created],Dates[Date],None)
)


Cumulative_Max_Days =
Was
d - Max (Dates[Date])
RETURN
CALCULATE(if([Open]>0,DATEDIFF(SN[OLDEST_Open_Date],d,Day),0))

View solution in original post

7 REPLIES 7
Super User IV
Super User IV

@pankajj 

For Cumulative Total, you need to use the SUM

Cumulative Max Days = 
CALCULATE(
    SUM(SN[DaysTillToday]), 
    FILTER(ALL ('Dates'), 'Dates'[Date] <= MAX('Dates'[Date]))
)

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Website   YouTube    LinkedIn

@Fowmy 

Thanks a ton for your quick reply.

Using Sum in the measure gives me following Result:

Screenshot1.png

However I am looking for a result which should be something like:

 

DateCumulative Max Days
September21 202013
September20 202012
September19 202011
September18 202010
September17 20209
September16 20208
September15 20207
September14 20206
September13 20205
September12 20204
September11 20203
September10 20202
September09 20201
September08 20200

 

@pankajj 
Can you share sample data from the date and the fact table, is cumulative max days a measure?

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Website   YouTube    LinkedIn

@Fowmy

I have uploaded PBIX & Excel sample data file for reference

https://drive.google.com/drive/folders/1m3uGRUPN28hqKPab2oYSmzO91z9t0BT3?usp=sharing

Thanks once again for your help.

@pankajj

I haven't exactly got what you're trying to do, but this measure will give you what you need

Cumulative Max Days = 

CALCULATE(
    COUNT(Dates[Date]),
    FILTER(
        ALLSELECTED(Dates),
        Dates[Date] < MAX(Dates[Date] )
    )
)

Fowmy_0-1600717034861.png

________________________

If my answer was helpful, consider Accepting it as the solution to help other members find it

Click the Thumbs-Up icon if you like this answer 🙂

Youtube Linkedin



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Website   YouTube    LinkedIn

View solution in original post

@Fowmy

Thanks a ton for your kind help. It worked perfectly with the sample file i shared.

In the meantime i created following measures to get the desired result in my existing data.

Open =
Was
(dates[Date])
RETURN
calculate(
CALCULATE(count(SN[ID])+0,
SN,
SN[Created]<=d
),
crossfilter(SN[Created],Dates[Date],None)
)

OLDEST_Open_Date =
Was
d - MAX (Dates[Date])
RETURN
CALCULATE(
FORMAT(CALCULATE(MIN(SN[Created]),
SN,
SN[Created]<=d),
"Short Date"
),
CROSSFILTER(SN[Created],Dates[Date],None)
)


Cumulative_Max_Days =
Was
d - Max (Dates[Date])
RETURN
CALCULATE(if([Open]>0,DATEDIFF(SN[OLDEST_Open_Date],d,Day),0))

View solution in original post

@Fowmy 

 

Sorry for the error, Html format has changed the table content.

 

I am looking for a result similar to :

 

Screenshot 2020-09-21 130825.png

Helpful resources

Announcements
secondImage

Congratulations!

We are excited to announce the Power BI Super Users!

Wave Release 2

Check out the updates in Power BI.

Overview of Power BI 2020 release wave 2!

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

secondImage

The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors