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
Anonymous
Not applicable

Running Total current month (When no date is selected)

I need to have this logic on my report page: 

If a date is selected (in a column chart) then calculate the Running Total for that day, when no date is selected, calculate the running total just for the current month.

My measure is: 

RTRevenue-CM =
VAR MaxDate =
MAX ( 'Calendar'[DateValue] )
RETURN
 
IF (
ISFILTERED ( 'Calendar'[MonthNameYear] ),
CALCULATE (
Revenue[Revenue Total],
FILTER ( ALLSELECTED ( 'Calendar' ), 'Calendar'[DateValue] <= MaxDate)
),
CALCULATE ( Revenue[Revenue Total], 'Calendar'[IsCurrentMonth]=1)
)
 
 
elimey68_0-1618300917420.png

But when no date is selected in the column chart, my running total is wrong. Where am I doing wrong?

1 ACCEPTED SOLUTION
v-cazheng-msft
Community Support
Community Support

Hi @Anonymous 

You can try this Measure.

 

RTRevenue-CM =

VAR MaxDate =

    SELECTEDVALUE ( 'Calendar'[DateValue] )

RETURN

    IF (

        ISBLANK ( MaxDate ),

        CALCULATE (

            SUM ( Revenue[Revenue] ),

            ALLEXCEPT ( 'Calendar', 'Calendar'[MonthNameYear] ),

            'Calendar'[IsCurrentMonth] = 1

        ),

        CALCULATE (

                Revenue[Revenue Total],

                FILTER ( ALLSELECTED ( 'Calendar' ), 'Calendar'[DateValue] <= MaxDate )

            )

    )

 

The result looks like this:

v-cazheng-msft_0-1618454890302.png

 

v-cazheng-msft_1-1618454890306.png

For more details, you can refer the attached pbix file.

 

Best Regards

Caiyun Zheng

 

Is that the answer you're looking for? 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

1 REPLY 1
v-cazheng-msft
Community Support
Community Support

Hi @Anonymous 

You can try this Measure.

 

RTRevenue-CM =

VAR MaxDate =

    SELECTEDVALUE ( 'Calendar'[DateValue] )

RETURN

    IF (

        ISBLANK ( MaxDate ),

        CALCULATE (

            SUM ( Revenue[Revenue] ),

            ALLEXCEPT ( 'Calendar', 'Calendar'[MonthNameYear] ),

            'Calendar'[IsCurrentMonth] = 1

        ),

        CALCULATE (

                Revenue[Revenue Total],

                FILTER ( ALLSELECTED ( 'Calendar' ), 'Calendar'[DateValue] <= MaxDate )

            )

    )

 

The result looks like this:

v-cazheng-msft_0-1618454890302.png

 

v-cazheng-msft_1-1618454890306.png

For more details, you can refer the attached pbix file.

 

Best Regards

Caiyun Zheng

 

Is that the answer you're looking for? 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.