Forum Discussion

GJD23's avatar
GJD23
Frequent Visitor
2 years ago
Solved

Sales Growth issues

Hi there - can anyone let me know where i am going wrong - trying to follow one of Chandeep Goodleys videos but not getting expected results - Prev Date correctly shows the previous date - but the Sales doesn't

 

Growth Test =
VAR PrevDateTest =
Maxx(
    Filter(
        ALL(DataFile[Doc. Date]),
        DataFile[Doc. Date] < SELECTEDVALUE(DataFile[Doc. Date])
    ),
    DataFile[Doc. Date]
)
VAR PrevSalesTestXX =
CALCULATE(
    [Sum of Buy Price],
    FILTER(
        ALL(DataFile[Doc. Date]),
        DataFile[Doc. Date] = PrevDateTest
    )
)
RETURN
PrevSalesTestXX


where am i going wrong??

  • Hi GJD23  Great, yes we have to remove the page level filter and check the value. it works as expected worked on similar scenerio. 

    Hope you find it useful.

     

    Did I answer your question? Mark my post as a solution! This will help others on the forum!
    Appreciate your Kudos!!

4 Replies

  • Hi GJD23 - the above issue might be due to context within the DAX measure. Calculation should correctly evaluates the sales for the previous date

     

    Try the below modified measure for growth test:

     

    Growth Test =
    VAR PrevDateTest =
    MAXX(
    FILTER(
    ALL(DataFile[Doc. Date]),
    DataFile[Doc. Date] < SELECTEDVALUE(DataFile[Doc. Date])
    ),
    DataFile[Doc. Date]
    )
    VAR PrevSalesTestXX =
    CALCULATE(
    [Sum of Buy Price],
    DataFile[Doc. Date] = PrevDateTest,
    REMOVEFILTERS(DataFile[Doc. Date])
    )
    RETURN
    PrevSalesTestXX

     

     

    Did I answer your question? Mark my post as a solution! This will help others on the forum!
    Appreciate your Kudos!!

  • GJD23's avatar
    GJD23
    Frequent Visitor

    Ah, i have another filter on the page, once i delete this , i get answers- just need to confirm if they are the correct answers lol

    • rajendraongole1's avatar
      rajendraongole1
      Super User

      Hi GJD23  Great, yes we have to remove the page level filter and check the value. it works as expected worked on similar scenerio. 

      Hope you find it useful.

       

      Did I answer your question? Mark my post as a solution! This will help others on the forum!
      Appreciate your Kudos!!

  • GJD23's avatar
    GJD23
    Frequent Visitor

    I still just get periodic answers on some random dates (same as previous) with most dates returning no value - thanks having a look