Compare Value between two dates

  • Compare Value between two dates

    Posted by DSC Communities on September 19, 2019 at 6:57 am
    • Damini Gohil

      Member

      September 19, 2019 at 6:57 AM

      Hello !

      I need two compare two value between two dates.

      I have a list with brand_name, terminal_description, product, price and date, and i need to know the price difference between two dates.
      So, i want to add a new column between two dates, which will show the price difference between that 2 dates.Ā 


      Thank you !

      ——————————
      Damini Gohil
      BI Developer
      ——————————

    • Vishesh Jain

      Member

      September 20, 2019 at 3:35 AM

      Hi ,

      You can filter the table using the MAX() function, which will give you the max date in the current filter context.
      Then you can filter the table again to find all the dates that are less than the max date and from the filtered table get the max date.
      For. e.g. Max date = 16th
      Then filter the date column with dates that are less than the 16th and find the max of that, which should be the 15th.
      Then using the LOOKUPVALUE() function you should be able to get the prices for both and then do the subtraction.

      You will need to use variables as it will make it easier to get the necessary pieces.

      Of course this is just a theory that could work.
      If you could upload your sample file, we can take a look at it.

      Hope this helps.

      Thank you,

      ——————————
      Vishesh Jain
      Owner
      VR Construction
      ——————————
      ——————————————-

    • Damini Gohil

      Member

      October 3, 2019 at 1:04 AM

      Thanks, but it does not work.

      ——————————
      Damini Gohil
      BI Developer
      ——————————
      ——————————————-

    • Vishesh Jain

      Member

      October 3, 2019 at 3:49 AM

      Hi ,

      If possible please can you share a sample file with us.

      Also, the dates in question here, of which you want to compare the prices, are these dates going to be consecutive or the could be any random 2 dates??

      The DAX code will differ depending on how you plan to make the selection of dates.

      Thank you,

      ——————————
      Vishesh Jain
      Owner
      VR Construction
      ——————————
      ——————————————-

    • Damini Gohil

      Member

      October 4, 2019 at 2:35 AM

      Hello ?,

      I want a difference between two dates which i have marked in picture and particular one column(difference between two dates) should be added between two date columns.

      Thank You,

      ——————————
      Damini Gohil
      BI Developer
      ——————————
      ——————————————-

    • Mick Fitzpatrick

      Member

      October 4, 2019 at 8:06 AM

      You need to setup a Dates dimension containing every date you’re likely to include, and create a relationship between this and your date_col.

      Then the following should work:
      SUM(Query1[price])-CALCULATE(SUM(Query1[price]), PREVIOUSDAY(‘Date_Dim'[Date]))

      There are probably better ways to do it !

      Mick

      ——————————
      Mick Fitzpatrick
      ——————————
      ——————————————-

    • Theo Bv

      Member

      December 28, 2021 at 5:58 AM

      Hi, I recommend creating a second table as the comparison basis with an inactive relationship. Here is a video that explains this:

      https://youtu.be/knXFVf2ipro

      ——————————
      Theo Bv
      Data Analyst
      ——————————
      ——————————————-

    DSC Communities replied 6 years, 6 months ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

The discussion ‘Compare Value between two dates’ is closed to new replies.

Start of Discussion
0 of 0 replies June 2018
Now

Welcome to our new site!

Here you will find a wealth of information created for peopleĀ  that are on a mission to redefine business models with cloud techinologies, AI, automation, low code / no code applications, data, security & more to compete in the Acceleration Economy!