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
MaxItaly
Helper III
Helper III

Cumulative passed days from smallest date

Hello everyone.

I have a "Subscriptions" table that has "User_id" column and "subscribe_date" Column.

I have a "Master Calendar" table with the "MasterDate" linked to "subscribe_date".

What I'd like to achieve (for using it in other formulas) is a line graph that shows the "subscribe_date" in the x axis and the cumulative passed days in the y-axis.

 

What should be the formula like?

I did something like

 

CumulativeDays =
CALCULATE(DATEDIFF(MINA('Subscriptions'[subscribe_date]); MAXA('Subscriptions'[subscribe_date]); DAY);
FILTER(ALLSELECTED('Master Calendar');
'Master Calendar'[MasterDate]<= MAX('Master Calendar'[MasterDate])))

 

but it's clearly not correct.

The formula should be equal to the number of days passed from the first subscription.

May someone please help me?

1 ACCEPTED SOLUTION
v-yulgu-msft
Employee
Employee

Hi @MaxItaly,

 

Please try this measure:

Passed days =
DATEDIFF (
    CALCULATE ( MIN ( Subscriptions[Subscription_date] ), ALL ( Subscriptions ) ),
    MAX ( Subscriptions[Subscription_date] ),
    DAY
)

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-yulgu-msft
Employee
Employee

Hi @MaxItaly,

 

Please try this measure:

Passed days =
DATEDIFF (
    CALCULATE ( MIN ( Subscriptions[Subscription_date] ), ALL ( Subscriptions ) ),
    MAX ( Subscriptions[Subscription_date] ),
    DAY
)

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Unfortunately it doesn't work:

Screenshot_1.png

I tried using both MasterDate and SubscribeDate as the x-axis.

It seems like it keeps taking the minimum value in the current selection and I don't understand why: the ALL() function should do the trick, isn't it?

 

Hi @MaxItaly,

 

Could you please post sample data and show us your desired output with examples?

 

Regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.