Forum Discussion

sinanalmac's avatar
sinanalmac
Icon for Resolver I rankResolver I
5 years ago
Solved

Running Total calculate in Tooltip

Hi all , 

 

I created running total measure  

 

Measure = CALCULATE(
SUM(Rpl_Satis_Flow_Unisel[TURNOVER]), FILTER(ALLSELECTED(Rpl_Satis_Flow_Unisel),
Rpl_Satis_Flow_Unisel[DATE].[Day]<=MAX(Rpl_Satis_Flow_Unisel[DATE].[Day])
))


It  works fine 

 

When put the this mesause in tooltip page  it doesn't run  correctly.

How Can Run this code in Tool tip correctly ?

 

 

 

 

 thank you

 

 

 

  • sinanalmac it is not as straightforward as it looks like but here is the solution, you need to understand the row context to understand the problem.

     

    To do it right, anytime you are doing date calculation, it is a best practice to add a Calendar/Date dimension in your model, you can add one following my blog post here Create a basic Date table in your data model for Time Intelligence calculations | PeryTUS IT Solutions

     

    After the above table is in the model, set the relationship with the transaction table on the date column, it will be one to many relationship.

     

    Now add a Running Total measure 

     

    RT Turnover = 
    CALCULATE ( 
        SUM ( YourTable[Turnover] ),  
        FILTER ( 
                ALL ( 'Calendar' ), 
                'Calendar'[Date] <= MAX ( 'Calendar'[Date] ) 
         ), 
        VALUES ( 'Calendar'[Month] ) 
    )

     

    In slicer, add month from the calendar table and in table visual, use date from calendar table and turnover column, on tooltip page, use above measure to show the running total and this will do it.

     

    ✨ Follow us on LinkedIn

     

    Check my latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

     

    ⚡ Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡

     

5 Replies

  • sinanalmac , try to avoid using date hierarchy element in this. If there is a timestamp then create a date column

    measure like 

    Measure = CALCULATE(
    SUM(Rpl_Satis_Flow_Unisel[TURNOVER]), FILTER(ALLSELECTED(Rpl_Satis_Flow_Unisel),
    Rpl_Satis_Flow_Unisel[DATE]<=MAX(Rpl_Satis_Flow_Unisel[DATE])
    ))

     

     

     

     

    Also the year , qtr and month in the visual should date part of the date Rpl_Satis_Flow_Unisel[DATE]

    • sinanalmac's avatar
      sinanalmac
      Icon for Resolver I rankResolver I

      Hi amitchandak 
      Thank you  for your reply .  I removed   the  day item from  Formulas but nothing changed. 😞
       It  still shows only the current value.

      Is there anything I can do  about it?

       

       


      Best Regards
      Sinan

       

  • sinanalmac it is not as straightforward as it looks like but here is the solution, you need to understand the row context to understand the problem.

     

    To do it right, anytime you are doing date calculation, it is a best practice to add a Calendar/Date dimension in your model, you can add one following my blog post here Create a basic Date table in your data model for Time Intelligence calculations | PeryTUS IT Solutions

     

    After the above table is in the model, set the relationship with the transaction table on the date column, it will be one to many relationship.

     

    Now add a Running Total measure 

     

    RT Turnover = 
    CALCULATE ( 
        SUM ( YourTable[Turnover] ),  
        FILTER ( 
                ALL ( 'Calendar' ), 
                'Calendar'[Date] <= MAX ( 'Calendar'[Date] ) 
         ), 
        VALUES ( 'Calendar'[Month] ) 
    )

     

    In slicer, add month from the calendar table and in table visual, use date from calendar table and turnover column, on tooltip page, use above measure to show the running total and this will do it.

     

    ✨ Follow us on LinkedIn

     

    Check my latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

     

    ⚡ Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡

     

    • sinanalmac's avatar
      sinanalmac
      Icon for Resolver I rankResolver I

      Hi , parry2k  This is definitely the Answer I'm trying to find

      Thank you so much 
      Best Regards
      Sinan 

    • sinanalmac's avatar
      sinanalmac
      Icon for Resolver I rankResolver I

      Hi I would like to  ask question About your code. The cod is working perfectly for the date september 2021 and earlier. 
      Example:

       

      But When I selected October(Last mont)The number are going huge. We are still in october. the month doesnt completer yet.  IT seems like adding previous  year The Same month  value. 

      Ocotober 2021

       

      Octorber 2020

      I didn figure out. Could you help me please?
       
      Best Regards
      Sinan