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
tanct
Regular Visitor

Running total

 

Hello All,

Would need your help in the DAX running total for the below scenario (running total for the MTD - month to date and PM - previous month):-

 

2017-11-01_14-21-07.png

 

My Dax:

RunningTotal =
 VAR
    CurrentDay = MAX ( 'Data Source'[Weekday] )
 RETURN CALCULATE (
  SUMX ( VALUES ( 'Data Source'[Weekday] ), sum('Data Source'[Standard Quantity KG 3rd Party]) ),
  'Data Source'[Weekday] <= CurrentDay
 )

 

First time I posted my question here, thanks for your kind assistance.

Unable to send the BI file over here, do let me know should you need it.

Thanks!!

 

 

 

1 ACCEPTED SOLUTION

Hello friend

@tanct

 

This shall do it

 

Cumulative  =
SUMX (
    FILTER (
        ALLEXCEPT (
            'Data Source',
            'Data Source'[Reformat],
            'Data Source'[SH - Country  docum.]
        ),
        'Data Source'[Weekday] <= SELECTEDVALUE ( 'Data Source'[Weekday] )
    ),
    CALCULATE ( SUM ( 'Data Source'[Standard Quantity KG 3rd Party] ) )
)

Regards
Zubair

Please try my custom visuals

View solution in original post

7 REPLIES 7
Zubair_Muhammad
Community Champion
Community Champion

@tanct

 

Try this Measure

 

Cumulative =
IF (
    HASONEVALUE ( 'Data Source'[Weekday] ),
    SUMX (
        FILTER (
            ALL ( 'Data Source' ),
            'Data Source'[Weekday] <= VALUES ( 'Data Source'[Weekday] )
        ),
        'Data Source'[Standard Quantity KG 3rd Party]
    )
)

Regards
Zubair

Please try my custom visuals

Dear Zubair,

 

It is still not working. This is my first time publish my issue here, do you know how to share the pbix file over here, it would be more efficient in this way.

2017-11-01_16-46-44.png

Hi @tanct

 

You can upload your file to onedrive or google drive and share the link here using "insert/edit link" option


Regards
Zubair

Please try my custom visuals

 

https://drive.google.com/file/d/0B_Wuqq42mXSEcVNJalBydGFyQmM/view?usp=sharing

 

Many thanks for your reply and prompt reply, could you please click on the link for PBIX download for your shared expertise.

Thanks@!

Hello friend

@tanct

 

This shall do it

 

Cumulative  =
SUMX (
    FILTER (
        ALLEXCEPT (
            'Data Source',
            'Data Source'[Reformat],
            'Data Source'[SH - Country  docum.]
        ),
        'Data Source'[Weekday] <= SELECTEDVALUE ( 'Data Source'[Weekday] )
    ),
    CALCULATE ( SUM ( 'Data Source'[Standard Quantity KG 3rd Party] ) )
)

Regards
Zubair

Please try my custom visuals

Hi @estewart,

 

Sorry for the delay.

 

To achieve your requirement, you could try the steps below.

 

1. Duplicate the table in Query Editor and filter the row to only show the records like below. 

 

filter rows.PNG

2.Then Apply and Close,  create the Index column for the two tables with IF function in Data View.

Index = IF('Table1'[Variable] in {"Trend_1","Trend_1_Start"},1,2)

Index = IF('Table2'[Variable] = "Trend_1_Start",1,2)

3. Create the lookupvalue calculated column in Table1. 

lookupvalue =
LOOKUPVALUE (
    'Table2'[Value],
    'Table2'[YearQuarter], 'Table1'[YearQuarter],
    Table2[Index], 'Table1'[Index]
)

Here is the output.

 

result.PNG

 

More details, please refer to the attachment.

 

Best  Regard,

Cherry

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

Zubair, thanks so much for your prompt support, it was resolved less than few hours after I posted my issue here.

Strongly recommend !

 

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.