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

Issue with Filtered running total

Hi Community!

 

I've been breaking my head for the past 3 days, googling and reading through this forum. I can't seem to find the solution to my problem, and would like to ask for your much valued help!

 

I have a Calendar Table for the whole year as follows:

 

Capture1.PNG

 

I then have a YTD file with all completion orders from an Assembly site. I have a connection from the DATE column on that file, to the DATE column on the CALENDAR table shown above.

 

I created a calculation that would tell me the DELTA (Goal - Actual) for each day of the filtered week:

 

DELTA =
SUM('Campus'[Hours]) - SUM('Campus Goals'[GOAL HRS])

 

But the issue comes with the Running Total of this Delta:

 

RT =
CALCULATE(
[DELTA],
FILTER(
ALLSELECTED('Table'[DATE]),
ISONORAFTER('Table'[DATE], MAX('Table'[DATE]), DESC)
)
)

 

This is what the data looks like (Note the error on column RT):

 

Capture2.PNG

 

Ultimately what I want is to graph that information as follows. I have a slicer that controls the WEEK. When you choose another week, the data changes. On the Line Chart I want the Runnin Total (right now it repeats the data from DELTA).

 

Capture3.PNG

 

Thanks for you support! I just can't see how to make it work!

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

Do you want the running total in a week? If so, modify your RT measure into below one, put the whole 'Calendar' table in ALLSELECTED() function rather than 'Calendar'[Date] column.

RT 2 =
CALCULATE (
    [DELTA],
    FILTER (
        ALLSELECTED ( 'Calendar' ),
        ISONORAFTER ( 'Calendar'[Date], MAX ( 'Calendar'[Date] ), DESC )
    )
)

You can also try below measure to calculate the running total.

RT =
SUMX (
    FILTER (
        ALLSELECTED ( 'Calendar' ),
        'Calendar'[Date] <= MAX ( 'Calendar'[Date] )
    ),
    [Delta]
)

022409.jpg

Regards,
Community Support Team _ Jing Zhang
If this post helps, please consider Accept it as the solution to help other members find it.

View solution in original post

5 REPLIES 5
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

Do you want the running total in a week? If so, modify your RT measure into below one, put the whole 'Calendar' table in ALLSELECTED() function rather than 'Calendar'[Date] column.

RT 2 =
CALCULATE (
    [DELTA],
    FILTER (
        ALLSELECTED ( 'Calendar' ),
        ISONORAFTER ( 'Calendar'[Date], MAX ( 'Calendar'[Date] ), DESC )
    )
)

You can also try below measure to calculate the running total.

RT =
SUMX (
    FILTER (
        ALLSELECTED ( 'Calendar' ),
        'Calendar'[Date] <= MAX ( 'Calendar'[Date] )
    ),
    [Delta]
)

022409.jpg

Regards,
Community Support Team _ Jing Zhang
If this post helps, please consider Accept it as the solution to help other members find it.

Anonymous
Not applicable

WOW! It worked! Thanks so much.

 

Could you help me understand what was I doing wrong? I would like to learn the logic on the program.

Anonymous
Not applicable

-Yes, Table is marked as a Date Table.

-Day and Date column are both in the Date table (see below).

 

Capture1.PNG

 

-I have a connection from 2 input Tables to the Data Table (Matching dates). This is to pull the SUM of ENG HOURS respect to each DATE from DATA table, filered by WEEK and expressed as DAY. See below.

 

Capture4.PNG

 

This is how the table looks. I use this to check if DAX is doing what I want:

Capture5.PNG

amitchandak
Super User
Super User

@Anonymous , Is Table, marked as the date table?

Are day and date columns coming from the same table?

 

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Anonymous
Not applicable

Please see my reponse below. I had some issues replying to your response. Thanks

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.