Forum Discussion

santoshlearner2's avatar
santoshlearner2
Resolver II
2 years ago
Solved

Daily changes

earlier i had posted this question but did not explain properly My knowledge is not that great in power bi, learning from all you guys. I tried solving it but cannot get it. Higly appreciate for taki...
  • santoshlearner2's avatar
    2 years ago

    Dear Yang,

     

    it is nice of you to reply, i truly appreciate it. The column marked in brackets viz A & B, ie 

    Unit Change (A)Rate Change (B)Final Result (A X B)

    This is derieved from minus the previous day values, which i get from a measure like current minus the previous etc.  This issue is when  i put the date in the slicer the values are correctly depicting, but if i put the same in the matrix, ( Since no date is selected) . It gives any error. 

     

    Thank you in advance for your much need assistance.

     

     

  • Alican_C's avatar
    Alican_C
    2 years ago

    Hi, I believe the measures you used causes it.
    I would handle them with calculated columns as follow:


    1st: 

    Daily Change =
    VAR PreviousDayUnits =
    CALCULATE(
    MAX(TableName[Units]),
    FILTER(
    TableName,
    TableName[Product] = EARLIER(TableName[Product]) &&
    TableName[Date] = EARLIER(TableName[Date]) - 1
    )
    )
    RETURN
    IF(
    ISBLANK(PreviousDayUnits),
    BLANK(),
    TableName[Units] - PreviousDayUnits
    )

    ---

    2nd: 

    Final Result = TableName[Daily Change]*TableName[Rate Change]

    Data table would look like this 

     

    And the matrix will work regardless of slicer selection:

     

  • santoshlearner2's avatar
    2 years ago

    Thank you, i appreciate your reply.  Hats off to you