Forum Discussion

skjellter's avatar
skjellter
Frequent Visitor
5 years ago
Solved

Get increase since yesterday

Hello everyone,

 

I have a dashboard that shows how many documents users have sent per month, this dashboard is refreshed every day.

 

Now I would like to show in the dashboard how many sent documents have been added since the day before.

 

I'm not that familiar with Dax yet, but is this possible to show?

 

Behind the dashboard is a database containing the data on which the documents were sent. I have also already linked the data table to the table with sent documents.

ā€ƒ

 

Thanks in advance!

 

Skjellter

  • Hi skjellter 

     

    First check whether PrevDate returns the correct previous date. Then modify PrevValue part like below:

    VAR PrevValue = COUNTX(FILTER(ALL(sendoutsView), sendoutsView[dateAdded] = PrevDate ), sendoutsView[id])

     

    You already use COUNTX function, so don't calculate COUNT(sendoutView[id]) again in COUNTX. Let me know whether it works or not.

     

    Jing

4 Replies

  • this is more a data source question than a DAX question. Does your data have a "Submitted Date"  column?  Also, you may want to explain how do you define "the day before" - that is rather ambiguous if you take timezones into account.

  • v-jingzhang's avatar
    v-jingzhang
    Icon for Community Support rankCommunity Support

    Hi skjellter 

     

    It is possible. But you need to have date or datetime column in the table to record the date and time when a document was sent. Then create the number of documents sent on a date and on its previous date. Finally calculate the difference between them. It looks like a daily difference calculation. 

     

    This is a solution with calculated column:

    Day to day difference in cumulative values DAX or Power Query

     

    And this is a solution with measure:

    Volume Diff =
    VAR ThisDate = MAX ( Table1[Date] )
    VAR PrevDate = MAXX ( FILTER ( ALL ( Table1 ), Table1[Date] < ThisDate ), Table1[Date] )
    VAR ThisValue = SUM ( Table1[Volume] )
    VAR PrevValue = SUMX ( FILTER ( ALL ( Table1 ), Table1[Date] = PrevDate ), Table1[Volume] )
    RETURN
    ThisValue - PrevValue
    

     

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

    • skjellter's avatar
      skjellter
      Frequent Visitor

      Hi v-jingzhang 

      Thanks for your help. I'll even share the table for completeness. In this, each row is a sent document, behind it is stated when it was sent and by which employee. The result is still incorrect. The 'this value' is correct, but I can't get the 'prev value' right.

       

      ā€ƒ

       

      VAR PrevDate = MAXX(FILTER(ALL(sendoutsView), sendoutsView[dateAdded] < ThisDate), sendoutsView[dateAdded])
      
      VAR ThisValue = COUNT(sendoutsView[id])
      
      VAR PrevValue = COUNTX(FILTER(ALL(sendoutsView), sendoutsView[dateAdded] = PrevDate ), COUNT(sendoutsView[id]))
      
      Return ThisValue - PrevValue

       

      I can't figure it ouy myself. What am i doing wrong?

       

      Cheers

      • v-jingzhang's avatar
        v-jingzhang
        Icon for Community Support rankCommunity Support

        Hi skjellter 

         

        First check whether PrevDate returns the correct previous date. Then modify PrevValue part like below:

        VAR PrevValue = COUNTX(FILTER(ALL(sendoutsView), sendoutsView[dateAdded] = PrevDate ), sendoutsView[id])

         

        You already use COUNTX function, so don't calculate COUNT(sendoutView[id]) again in COUNTX. Let me know whether it works or not.

         

        Jing