difference between parallelperiod and sameperiodlastyear | Power BI DAX Tutorial

Sdílet
Vložit
  • čas přidán 30. 07. 2024
  • #powerbi #sameperiodlastyear #parallelperiod #dax #powerbitraining
    This video points out the differences between parallelperiod and sameperiodlastyear .It is a continuation of my Power BI DAX Tutorial.
    SAMEPERIODLASTYEAR returns a table containing a date column just shifted one year back .
    See the use of the word PERIOD in this function .
    Hence it can be used to get the Sales for:
    1.One year back or
    2.Same Quarter Previous Year
    3.Same Month Previous Year
    The syntax for this function is as follows:
    SAMEPERIODLASTYEAR(dates)
    Dates - A column that contains dates.
    PARALLELPERIOD DAX function enables you to get the parallel period with respect to the current period. You can either travel to the future (months /qtr/year) or the past (months /qtr/year). This function has the below syntax and accepts 3 mandatory parameters.
    Syntax :ParallelPeriod(date field, number of intervals, interval)
    Date Filed is the column on which your date dimension is based .No of intervals to be Month, Quarter, or Year. and the number of intervals can be -ve (for past), or +ve (for future).The interval itself can be MONTH , QUARTER OR YEAR
    Explanation of PARALLELPERIOD in Power BI desktop
    Our main aim here is to create a measure to get the sales for previous month .I have created a simple dax using PARALLELPERIOD function to achieve this
    Parallel Period (Last Month) = CALCULATE(
    sum(Sales[Sales Amount]),
    PARALLELPERIOD(‘Date'[Date],-1,MONTH)
    )
    Do watch this video where I have also clearly explained the differences between arallelperiod and sameperiodlastyear.
    Now since we know how these two functions behave we can easily differentiate between them.
    Difference 1: Parallelperiod lets to traverse both forward and backward in time while SamePeriodLastYear lets you calculate period only one year back .
    Difference 2: I would say that Parallelperiod can be computed for any no of months /Years provided correct data resides in DWH. .May seem like a weird requirement but For example even if you want to see the sales for past 45 months .Its possible using the paralelperiod dax as shown below
    PARALLELPERIOD(‘Date'[Date],-45,MONTH)
    Difference 3 :Parallelperiod is bound by the intervals we give .So if you give month as interval it will return you the monthly Sales and if you give year as interval you will get Yearly Sales .So be very careful in using this since if you are having a visual at a day level (as shown above) its not advisable to use paralleperiod to get the daily Sales for previousyear .For this scenario you can use SameperiodLastYear .
    Do watch and give your feedback!

Komentáře • 23

  • @powerbizone
    @powerbizone  Před 2 lety +2

    Hello Guys !You can download the pbix file from here 👉drive.google.com/file/d/1gKmoD9C9RNq2IrkBV0UHyNbmR3GhV5Q0/view?usp=sharing
    If you like my explanations please do not forget to Like 👍and Subscribe which inspires me to do more for our Power BI Community

    • @dcpowered
      @dcpowered Před 2 lety +1

      Please add this to your video description. At my workplace, the youtube comments are disabled by default. I had to download it from my phone and transfer to my computer. Thank you!

  • @fadzaimakore9909
    @fadzaimakore9909 Před 5 měsíci

    well explained, thank you

  • @powerbizone
    @powerbizone  Před 2 lety +1

    You can download the dataset from : drive.google.com/file/d/1gKmoD9C9RNq2IrkBV0UHyNbmR3GhV5Q0/view?usp=sharing
    If you like the Video please subscribe and hit the bell Icon to get all the updates♦

  • @mystuffstudy1403
    @mystuffstudy1403 Před rokem +1

    Very well explained

  • @dcpowered
    @dcpowered Před 2 lety +1

    Thanks a lot! Very clear explanations. You just earned a new subscriber! 😁

    • @powerbizone
      @powerbizone  Před 2 lety

      Glad you liked the video bro and thanks for the sub !Do spread the message to your colleagues so that we can learn the Power BI concepts together

    • @dcpowered
      @dcpowered Před 2 lety +1

      @@powerbizone could you please make a video to explain how to show YTD for current year and previous years (more than one)?

    • @powerbizone
      @powerbizone  Před 2 lety

      @@dcpowered Will keep this in mind bro .As of now you can refer to below.
      community.powerbi.com/t5/Desktop/YTD-Across-multiple-previous-years-based-on-latest-date/m-p/707355

  • @sakshinaik05
    @sakshinaik05 Před 2 lety +1

    Thanks for the crisp n clear explanations. What is the diff betn advanced editor and applied steps?

    • @powerbizone
      @powerbizone  Před 2 lety +1

      Thank you Sakshi .Glad you liked it .
      Below is the simplest explanation on the difference you have asked .
      Advanced editor: If you want to observe the code that the Power Query editor is creating with each step, or want to create your own shaping code, you can use the advanced editor.
      Applied steps: Every transformation that is applied to your query is saved as a step in the Applied steps section of the query settings pane.
      These same steps are replicated as Mcode inside the Adv editor
      For more please visit: docs.microsoft.com/en-us/power-query/power-query-ui

  • @sakshinaik05
    @sakshinaik05 Před 2 lety +1

    How to use Dax studio?

    • @powerbizone
      @powerbizone  Před 2 lety

      Hi Sakshi .You can go to daxstudio.org/ and follow the instructions .There are other web pages as well which explains the usage :)

    • @sakshinaik05
      @sakshinaik05 Před 2 lety +1

      @@powerbizone in real time do we use Dax studio or formula bar for Dax fun

    • @powerbizone
      @powerbizone  Před 2 lety +1

      @@sakshinaik05 :Generally Formula bar is enough .But if you want in dept analysis install Dax studio

  • @sandeshpadigela2079
    @sandeshpadigela2079 Před 2 lety +1

    Hi, question- I have data -country-wise and segment sales for 2018 and 2019, though Dax we got 2018 total and 2019 segment and region-wise sales. Now, I am trying to compare both years' want put condition if any of the example 2019 bike data greater than 2018 bike want to assign an up arrow another wise down arrow.( it is not with in row or column 2018 vs 2019 column)

    • @powerbizone
      @powerbizone  Před 2 lety

      Hi Sandesh .Thank you very much for your comment .Although I am not very clear about the exact requirement here .But it seems ,you need to calculate the difference using a separate measure and use conditional formatting .Just google you should finds tons of references in this topic

    • @sandeshpadigela2079
      @sandeshpadigela2079 Před 2 lety +1

      @@powerbizone I can able to do with in column or row not 2018 differnt column and 2019 differnt column not able to get it in power bi

    • @powerbizone
      @powerbizone  Před 2 lety

      @@sandeshpadigela2079 Sorry bro not able to get you clearly .Could you try posting your comment in community.powerbi.com

  • @sandeshpadigela2079
    @sandeshpadigela2079 Před 2 lety +1

    Bro this is directly up-loaded - you should have shown excel data first then what you have added etc., but directly shown from graph which creating confusion

    • @powerbizone
      @powerbizone  Před 2 lety

      Sorry for the confusion Sandesh and thank you for the comment. I have actually shown the excels in my previous videos .However you can simply download the pbix from the pinned comment and practice : ) .All the best !