Power Bi : Build a simple Linear Regression Equation in DAX to Predict a Goal

Поделиться
HTML-код
  • Опубликовано: 1 авг 2024
  • **UPDATE**: We have reached 850 SUBSCRIBERS as of 3/17/2022. What date did the model predict we would hit this goal - • Power Bi : Evaluating ...
    We have reached 500 subscribers!
    In this video I will teach you how to build a simple linear regression model to predict the exact day when the channel will hit 1,000 subscribers.
    0:00 Start
    0:28 RUclips Dataset
    2:01 Calculate Running Total
    6:24 The Regression Equation
    8:37 Regression in DAX
    16:25 Graphing Regression Line
    17:10 The Slope
    24:57 Expected Goal Date
    29:12 Regression past Current Day
    35:16 Thank You!
    I apologize about the audio quality during the first few minutes. Issues with my MIC.
    Helpful blog: xxlbi.com/blog/simple-linear-...
    DAX FORMULAS -
    RUNNING TOTAL:
    TimeFrameSubscribers =
    CALCULATE(Sum(Subscribers[Subscribers]),
    FILTER(ALLSELECTED(Subscribers),
    Subscribers[Date] &lt= Max(Subscribers[Date]))
    )
    REGRESSION EQUATION (DAX):
    RegressionLine =
    var data =
    FILTER(
    SELECTCOLUMNS(ALLSELECTED(Subscribers),
    "x_values",Subscribers[Date],
    "y_values",[TimeFrameSubscribers]
    ),
    AND(
    NOT(ISBLANK([x_values])),
    NOT(ISBLANK([y_values]))
    )
    )
    --Variables to Solve for:
    var y_sum = SUMX(data,[y_values])
    var x_sum = SUMX(data,[x_values])
    var x2 = SUMX(data,[x_values]^2)
    var xy = SUMX(data,[x_values]*[y_values])
    var row_count = COUNTROWS(data)
    --Solve for formula
    var Intercept = (y_sum * x2 - x_sum * xy)/ (row_count * x2-(x_sum) ^2)
    var Slope = (row_count * xy - x_sum * y_sum)/( row_count * x2-(x_sum) ^2)
    --Regression
    var Regression = SUMX(Subscribers, Slope * Subscribers[Date] + Intercept)
    return Regression
  • НаукаНаука

Комментарии • 39

  • @jamierandall-schab2694
    @jamierandall-schab2694 2 года назад +8

    Having been learning PBI for the last few years and having watched lots and lots of videos - this is one of the best - absolutely awesome. I've already adapted it for new insights in my organisation. I'm subscribed

    • @DapperDash
      @DapperDash  2 года назад +3

      Hey Jamie. Thanks brother. Glad it helped you out. Sharing knowledge is how we all grow and learn. Appreciate the sub.

  • @rauljimenez5485
    @rauljimenez5485 2 года назад +9

    The breakdown of the linear regression is gold!!! Thank you very much for sharing this!!

    • @DapperDash
      @DapperDash  2 года назад

      Hey Raul! I appreciate the comment. Thank you. I am glad you found it useful.

  • @gambu4810
    @gambu4810 2 года назад +9

    You are absolutely brilliant!! I'm subscribed, l guess because of this video you are reaching the 1k way earlier than predicted.

    • @DapperDash
      @DapperDash  2 года назад +2

      Thank you thank you 🙏. We are on our way to 1K. Baby steps.

  • @DanielHernandezCa
    @DanielHernandezCa 2 года назад +5

    Thank you! Keep on the good work!

  • @danieldemasi6904
    @danieldemasi6904 2 года назад +1

    That's really good. When i did this for my data I had to summarize the raw data as I had multiple entries per day.

  • @oswaldocastro9600
    @oswaldocastro9600 2 года назад +5

    Incredible what you do... We close a difficult deal just by applying what I get from here. Fantastic job and really many thanks to share with us. Not just subscriber, a fan from now on!

    • @DapperDash
      @DapperDash  2 года назад

      Oswaldo, I totally missed your comment. That is amazing! I am glad the content was able to help you. That's what it is all about, helping each other out. I provided a video update so you can see how close the model is to where my channel is today. The link is in the description. Check it out.

  • @HomegrownHowTo
    @HomegrownHowTo 2 года назад +4

    Good info! Great stuff!

  • @alexandreos35
    @alexandreos35 Год назад

    you taught me EXACTLY what I needed for my job! (by the way, in october, when I first watched this video you were at 1,3k subscribers, so your trendline must be correct, now I'm another sub!)

  • @warrendeanthomas
    @warrendeanthomas 2 года назад +1

    Looks on you are on track for 1000 subs, good video!!

    • @DapperDash
      @DapperDash  2 года назад +1

      Hey Warren, haha yeah the regression told me sometime in June, so we'll see. I think it will be closer to July but it was a fun experiment

  • @salahderdar5148
    @salahderdar5148 2 года назад

    That's awesome, You're a genius, guy, I'm your fan from now on 👍
    But we will be thankful if you make another tutorial for multiple regression using two or three variables 🙏

    • @DapperDash
      @DapperDash  2 года назад +2

      Salah, thanks for the support. Yes, I am actually working on putting together a multiple variable regression tutorial. Stay tuned.

  • @350maybrick
    @350maybrick Год назад

    Thanks!

  • @AnilKumar-bd2yt
    @AnilKumar-bd2yt 2 года назад +4

    Nice

  • @PhoebeeMo
    @PhoebeeMo Год назад +1

    Hi Victor! This is awesome! I am so happy to find you. I am curious on when did you hit 1000 subscriber? :)

  • @paanjo10
    @paanjo10 9 месяцев назад

    Holy shit, this is what my boss wanted and I managed to do this because the dataset is almost similar. lmao thank you!!

  • @sanketwagh4483
    @sanketwagh4483 Год назад +1

    Thanks for the informational tutorial. Do you know how can we show the values in %?
    Like in terms of trend how much is it up/down

  • @elikyals
    @elikyals 2 года назад

    Congratulations, you hit a thousand before the predicted Date.

    • @DapperDash
      @DapperDash  2 года назад +1

      Hey! yeah I ended up reaching the goal on June 9th!. It is crazy how accurately close it was.

  • @salmahanifah2364
    @salmahanifah2364 Год назад +2

    hi, thank you for your tutorial. can you explain how, to sum up of x variable? because x is the date. not number.

  • @casperselmerfrandsen9691
    @casperselmerfrandsen9691 2 года назад +1

    I have two columns, X and Y, and want to make a simple linear regression to predict Y based on X. I need to be able to apply a filter to choose selected rows based on a value in a third column, Z,. Will it be possible to do this using this method?

  • @marcinterlecki7744
    @marcinterlecki7744 2 года назад +1

    It's June 15 2022 and you have 1k subscribers :)

    • @DapperDash
      @DapperDash  2 года назад

      Hey Marcin! I ended up reaching the goal on June 9th. Crazy how accurately close it was. It was a fun exercise.

  • @nehasaxena4169
    @nehasaxena4169 2 года назад

    I have daily sales data but I want the linear regression by month year this is not. Giving correct result could you please help .thanks

  • @itzhimari8494
    @itzhimari8494 Год назад

    Comprehensive solution how to create regression for beginners

  • @user-yv2fw3cb8p
    @user-yv2fw3cb8p 2 года назад +1

    great,可以出个指数平滑法预测视频吗

    • @DapperDash
      @DapperDash  2 года назад

      I will look into Exponential Smoothing and see what I can build. It would most likely be simple exponential smoothing. Anything else may require Python or R to display.

  • @350maybrick
    @350maybrick Год назад

    A little help. Very frustrated right now.
    I keep getting this error.
    The syntax for ')' is incorrect. (DAX(var data=SELCTCOLUMNS(ALLSELECTED(DataSource), "x_values",DataSource[CloseDate], "y_values",[SalesVolume]))).
    This is what I have typed into the DAX Editor
    1 RegressionLine =
    2
    3 var data =
    4
    5 SELECTCOLUMNS(ALLSELECTED(DataSource),
    6 "x_values",DataSource[Close Date],
    7 "y_values",[SalesVolume]
    8 )
    I have verified there is no blank data.
    Any help is appreciated.

  • @easy.peasey
    @easy.peasey 2 года назад +1

    idk what I did by my regression line is flat. Also, I am using a really bad data set so I think thats the reason.

    • @DapperDash
      @DapperDash  2 года назад +1

      EasyPeasey, my email is on the "About" section of the channel. You can send my a csv or excel file of your dataset and I can see what might be going on.

    • @easy.peasey
      @easy.peasey 2 года назад

      @@DapperDash I believe I figured it out. I needed to make a measure versus using quick measures. But now m regression line goes up and down versus a line. I think that is technically fine tho.

  • @juanarmandoarteagasabja6021
    @juanarmandoarteagasabja6021 2 года назад

    The analisis was correct, you are 1000 subscribers by jun!! im subscribe now!!

    • @DapperDash
      @DapperDash  2 года назад +1

      It was kind of interesting, I hit the goal about a day early from the video prediction. For a simple linear regression, it was scary how accurate it became.

  • @powerbinareal
    @powerbinareal Год назад +1

    Muito legal! Sou do Brasil e produzo conteúdos também!