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
majdkaid22
Helper V
Helper V

get ride of excess days in chart

Hi guys,

 

I have created a cumulative calculated measure 

 

 

Measure = CALCULATE(SUM(meAccountTransaction[Deposits]),(FILTER(ALL(meCalendar[DateValue]),meCalendar[DateValue]<=MAX(meCalendar[DateValue]))))

Am using a Calender table which has dates until end of 2018, hence the line chart is showing all days of the month 

 

powerbi22.JPG

 

Is there any Date measure I can use to filter out the excess days (the future days/months/years) that I can create/apply?

 

 

 

Thanks,

Majd

1 ACCEPTED SOLUTION
BhaveshPatel
Community Champion
Community Champion

In order for below measure to work, You need to create a date key column in both of your tables( meCalender and meAccountTransaction) as shown below and create the relationship based on this "DateKey" Column.
 
This will check the condition before evaluating the original measure of the cumulative total.
 
DateKey ColumnDateKey Column
 
 
Cumulative Total:=
IF (
    MIN ( meCalender[DateKey] )
        <= CALCULATE ( MAX ( meAccountTransaction[DateKey] ), ALL ( meAccountTransaction ) ),
    CALCULATE (
        SUM ( meAccountTransaction[Deposits] ),
        FILTER (
            ALL ( meCalender[DateValue] ),
            meCalender[DateValue] <= MAX ( meCalender[DateValue])
        )
    )
)
 
 
Thanks & Regards,
Bhavesh

Love the Self Service BI.
Please use the 'Mark as answer' link to mark a post that answers your question. If you find a reply helpful, please remember to give Kudos.

View solution in original post

3 REPLIES 3
BhaveshPatel
Community Champion
Community Champion

In order for below measure to work, You need to create a date key column in both of your tables( meCalender and meAccountTransaction) as shown below and create the relationship based on this "DateKey" Column.
 
This will check the condition before evaluating the original measure of the cumulative total.
 
DateKey ColumnDateKey Column
 
 
Cumulative Total:=
IF (
    MIN ( meCalender[DateKey] )
        <= CALCULATE ( MAX ( meAccountTransaction[DateKey] ), ALL ( meAccountTransaction ) ),
    CALCULATE (
        SUM ( meAccountTransaction[Deposits] ),
        FILTER (
            ALL ( meCalender[DateValue] ),
            meCalender[DateValue] <= MAX ( meCalender[DateValue])
        )
    )
)
 
 
Thanks & Regards,
Bhavesh

Love the Self Service BI.
Please use the 'Mark as answer' link to mark a post that answers your question. If you find a reply helpful, please remember to give Kudos.

Thanks @BhaveshPatel it worked as a treat. I found PostingDateID in the meAccountTransaction, and I did have Datekey in my calander!

 

one more question, if I want to create a Datekey for other tables I have, what formula should I use for a custom column to tranform a Date to DateKey in the same formart you stated in your earlier reply?

 

 

Thanks,

Majd

Use this formula in Calculated Column to create a DateKey Column.

 

 

DateKey=meCalender[CalendarYear]*10000 + meCalender[Month Number]*100+DAY(meCalender[DateValue])

Thanks & Regards,
Bhavesh

Love the Self Service BI.
Please use the 'Mark as answer' link to mark a post that answers your question. If you find a reply helpful, please remember to give Kudos.

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.