Power BI DAX: Running Totals Using Variables, CALCULATE, and FILTER

  Рет қаралды 67,732

Pragmatic Works

Pragmatic Works

3 жыл бұрын

In this video, I show how you can make a calculated column that will return a running total of values. By using variables and the function CALCULATE with the DAX language you can filter your calculate to run on a specific amount of dates as well as a filtered value from another column.
If you enjoy this video or any of my other videos and are interested in formal training on Power BI, Power Apps, Azure, or other Microsoft products you can use my code "Matt20" to get an extra of 20% off at check out when purchasing any private training or On-Demand Learning classes from pragmaticworks.com/pricing/ #MatthewPeterson
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - -
Next step on your journey:
👉 On-Demand Learning Courses FREE Trial: www.pragmaticworkstraining.co...
🔗Pragmatic Works On-Demand Learning Packages: pragmaticworks.com/pricing/
🔗Pragmatic Works Boot Camps: pragmaticworks.com/boot-camps/
🔗Pragmatic Works Hackathons: pragmaticworks.com/private-tr...
🔗Pragmatic Works Virtual Mentoring: pragmaticworks.com/virtual-me...
🔗Pragmatic Works Enterprise Private Training: pragmaticworks.com/private-tr...
🔗Pragmatic Works Blog: blog.pragmaticworks.com/
Let's connect:
✔️Twitter: / pragmaticworks
✔️Facebook: / pragmaticworks
✔️Instagram: / pragmatic.works
✔️LinkedIn: / pragmaticworks
✔️KZbin: / pragmaticworks
Pragmatic Works
7175 Hwy 17, Suite 2 Fleming Island, FL 32003
Phone: (904) 413-1911
Email: training@pragmaticworks.com

Пікірлер: 100
@28goldenboy
@28goldenboy Жыл бұрын
This was by far the best, easiest, and most concise explanation for running totals on PowerBI! Thanks a lot for putting this together.
@sabarashid1513
@sabarashid1513 5 ай бұрын
You are a life saver! I was searching exactly for this - running total for date and category together. Everywhere I searched, it was either only by date or category. Thanks alot!
@nampai
@nampai 3 жыл бұрын
It took me an eternity to find this solution online. Thank you so much!
@PragmaticWorks
@PragmaticWorks 3 жыл бұрын
You are welcome! Glad we could help provide a solution for you!
@Mj27th
@Mj27th 6 ай бұрын
Probably the greatest video I've ever seen explaining a DAX formula for Power BI. You have a new subscriber from me. I will be watching all these videos
@ginebranordes
@ginebranordes Жыл бұрын
I have been trying to do this for days!!!! Thank you so much! I actually finally understand how filtered tables work. Just amazing!
@Serraomomma
@Serraomomma Жыл бұрын
Well done, well said, the pace is excellent, the explanations are clear and you are appreciated! Looking forward to the next one!
@xalladus
@xalladus 2 жыл бұрын
I watched way too many videos on this, and this was the first one that actually made sense to me. Even though it wasn't the exact solution I needed, the way it was explained made it easy to adapt to my project. Thank you so much! I only found out about power BI 3 days ago, I am so behind.
@PragmaticWorks
@PragmaticWorks 2 жыл бұрын
You're welcome! Thank you for your comment (:
@patricktemple2724
@patricktemple2724 Жыл бұрын
Great video, spent ages watching other videos and reading through online guides but this one sorted my issue straight away!
@PragmaticWorks
@PragmaticWorks Жыл бұрын
Happy to help!!
@RakeshSaha1705
@RakeshSaha1705 Жыл бұрын
Thank you Sir. Along with the way you have shown here, I made a little modification to get a S curve which is restricting a cumulative value upto a certain date. This video is a super help.
@marxoman
@marxoman 8 ай бұрын
It took me only 5 hours to find this video, verry helpfull since i need to have multiple running totals for diffrent suppliers.
@denyskorcheniuk5920
@denyskorcheniuk5920 2 жыл бұрын
Sir, you have just saved a couple of days of my life. Thank you for your tutorial.
@PragmaticWorks
@PragmaticWorks 2 жыл бұрын
You are most welcome
@selcukkartal6724
@selcukkartal6724 Жыл бұрын
I was searching for a proper way of calculate func with dynamic filters. Video helped me a lot. thank you
@veebee3969
@veebee3969 Жыл бұрын
Thank you. Great video. Clear explanations. I worked out the example with jumbled up Agency rows and ended up with the correct answer.
@user-oj5fb3qt6k
@user-oj5fb3qt6k Жыл бұрын
By Far The Best Explanation so far
@sujeshfca5723
@sujeshfca5723 2 жыл бұрын
I watched and learned easily from Your Video. Thank you first of all. Yes you are the best teacher and know how to present , Explain and transfer it to the mind of the listener. I really appreciate this.Excellent
@PragmaticWorks
@PragmaticWorks 2 жыл бұрын
Thanks so much for the feedback!
@meilstone
@meilstone 10 ай бұрын
Thanks for this great explanation! That filter even works on the grand total below!
@Agxo1
@Agxo1 Жыл бұрын
Wow this was amazing. I spent days trying to figure this out. Thanks!!
@PragmaticWorks
@PragmaticWorks Жыл бұрын
Glad it helped!
@jhongagaful
@jhongagaful Жыл бұрын
You have saved my life, totally clear. TY
@BrosseauFarms
@BrosseauFarms Жыл бұрын
thank you thank you thank you!!!! I've been racking my brain on making a perpetual inventory column and you solved my problem!!!! you now how a loyal new subscriber.
@PragmaticWorks
@PragmaticWorks Жыл бұрын
You're very welcome!
@peterblenard9161
@peterblenard9161 Жыл бұрын
Thank you so much! This has been puzzling me for days!
@fromtonghua5018
@fromtonghua5018 7 ай бұрын
Excellent tutorial. Explained step by step.
@margotkk
@margotkk 11 ай бұрын
This is a really useful tutorial - thanks for posting it!
@jamesdeanstephens
@jamesdeanstephens 4 ай бұрын
Thank you! I was really trying to find something that wasn't a measure in this specific project that I'm working on.
@jeromeastier462
@jeromeastier462 8 ай бұрын
Exactly what I was looking for. Thanx! Plus it’s clear and simply put!
@PragmaticWorks
@PragmaticWorks 8 ай бұрын
So glad you liked the video Jerome, thank you for learning with us!
@adammazeli
@adammazeli 4 ай бұрын
thank you so much for the help. blessed you sir
@ikaridan
@ikaridan Жыл бұрын
😎Your didatic is very clear, it´s rarely in youtube, thanks for share your knowledge!!!
@MrThapaliya233
@MrThapaliya233 2 жыл бұрын
Very well explained, thank you!
@PragmaticWorks
@PragmaticWorks 2 жыл бұрын
You are welcome!
@jamilbouchaibi8585
@jamilbouchaibi8585 Жыл бұрын
Exactly what I was looking for. Tx
@rubenaugustine8666
@rubenaugustine8666 4 ай бұрын
Thanks, Matt
@oscarsantanafernandez5719
@oscarsantanafernandez5719 Жыл бұрын
Excellent video. Great explaining and showing of the programming! Just suscribed to the channel!
@PragmaticWorks
@PragmaticWorks Жыл бұрын
Welcome aboard! Thank you!
@imaneess4079
@imaneess4079 11 ай бұрын
Thank you very much for the explanation. Very well explaned and very helpful :)
@joa0liveira92
@joa0liveira92 Жыл бұрын
Awesome explanation! Easy and direct to the problem.
@PragmaticWorks
@PragmaticWorks Жыл бұрын
Great to hear!
@rewave2297
@rewave2297 2 жыл бұрын
It was very helpful, thanks a lot!
@PragmaticWorks
@PragmaticWorks 2 жыл бұрын
Glad you enjoyed it!
@daniyarberik9492
@daniyarberik9492 11 ай бұрын
🎉 you’re best!!! Thank you so much!
@chaolimeng8926
@chaolimeng8926 11 ай бұрын
Hi, I found your Channel really helpful, you can explain complicated things quite easy to understand. Do you happen to have a video explaining cardinalities in iterator and relationship? Thank you very much!
@sepehreftekharian8659
@sepehreftekharian8659 2 жыл бұрын
It was the exact same solution that I was looking for days. Thank you so much. Now the question is how can you show that in clustered and line chart? Thanks
@dribeiro9564
@dribeiro9564 Жыл бұрын
Thanks for the video!!!!
@PragmaticWorks
@PragmaticWorks Жыл бұрын
Thanks for watching!
@carolalves7807
@carolalves7807 Жыл бұрын
Thank you for the video, it was really helpful! Just another question, is there a way to filter the table, so it just shows the last row for each branch, without it messing out with the calculation?
@julie_chen
@julie_chen 2 жыл бұрын
Thank you.
@PragmaticWorks
@PragmaticWorks 2 жыл бұрын
You're welcome (:
@kennethstephani692
@kennethstephani692 2 жыл бұрын
Great video!
@PragmaticWorks
@PragmaticWorks 2 жыл бұрын
Glad you enjoyed it!
@fadwa2413
@fadwa2413 2 жыл бұрын
Thank you so much,Please Keep Going.
@PragmaticWorks
@PragmaticWorks 2 жыл бұрын
Glad you enjoyed!
@Tahuti418
@Tahuti418 2 жыл бұрын
Great thank you!!
@PragmaticWorks
@PragmaticWorks 2 жыл бұрын
Glad it was helpful!
@Matteinko
@Matteinko 3 жыл бұрын
Oddly this is one of those videos online that, if learnt by heart, can land you a GOOD JOB and at this date it has ~650 visualizations 😂😁
@MrThapaliya233
@MrThapaliya233 2 жыл бұрын
Agree!
@lakeshed
@lakeshed 2 жыл бұрын
Totally agree
@laalaajonsen
@laalaajonsen Жыл бұрын
You think this example is that highly sought after? Interesting
@elipomerantz6980
@elipomerantz6980 Жыл бұрын
Great video
@PragmaticWorks
@PragmaticWorks Жыл бұрын
Glad you enjoyed it
@walidkhlil2872
@walidkhlil2872 2 жыл бұрын
thanks
@PragmaticWorks
@PragmaticWorks 2 жыл бұрын
You're welcome!
@frezerzelalem4017
@frezerzelalem4017 Ай бұрын
This is great solution.Thanks! I tried to recreate as exactly what you did with VARIABLES and it worked. But tried without the variables and it didn't work correctly, instead returned the total sum of all values (72). Not sure why
@dcw888
@dcw888 2 жыл бұрын
Thanks for your solution and it worked in my problem well. However, when I tried to slice the data using a slicer, the DAX does not take the sliced data into account. The DAX calculation still ignores the slicer. For example, if you create a slicer on Sales[Date] in your example, when you slice it, the DAX calculation will not change in accordance to the slicer.
@lucianmuntean5534
@lucianmuntean5534 2 жыл бұрын
What if you have for the same Agency 2 rows with the same date but diffrent sales no. then the summ won't work for the columns with the same date
@xuyi2893
@xuyi2893 2 жыл бұрын
Not sure whether you can introduce if we want to create the measure instead of adding the column. I tried to add the columns it works, but it doesn't work if I want to create the measure. Would you help to introduce that? Thanks! But really appreciate that video.
@jayatushar
@jayatushar Ай бұрын
Nice...hlelped me. However a question -- do we have to have the records sorted in ascending order of the date? or does system/Dax take care of this?
@thithanhhuyenpham9961
@thithanhhuyenpham9961 2 жыл бұрын
Thank you so much. My case has a problem that the same Agency had more than 1 transaction on the same day. Ex: 1/1/2021 Agency A transacted 2 times. As a result, the running total of 2 transactions is equal. Hope you give me a solution.
@williamarthur4801
@williamarthur4801 2 жыл бұрын
Really interesting approach, and one to add to my list of 'how to', do you think it has any advantage over just ( and I do mean for a column, never a measure ), using 'EARLIER' and just decaling a VAR for 'agency' or my own favorite, in the case of above; CALCULATE, SUM(Sales[Sales] , FILTER(ALLEXCPT(SALES, SALES[AGENCY] ), SALES [DATE] < = EARLIER ( SALES[DATE]) ) ) Which does away with declaring agency as a variable and using && to join to earlier. I am in power pivot more than bi.
@jeffreyropp
@jeffreyropp 2 жыл бұрын
Why does the running total get summarized when used in a chart? My similar sample data looks as expected in a table visualization or in the data view, but in a chart context the new column gets summarized without an option to not do so.
@philipstern2929
@philipstern2929 3 жыл бұрын
This video has helped me a lot! Could you tell me if there is any solution to make the running totals filter by year in a new column? I want to make my Running Totals start from 0 when a new year starts but I find no way to make that work in a new column. Thanks a lot!
@TheAlgebraTeacherPOWERStoBI
@TheAlgebraTeacherPOWERStoBI 3 жыл бұрын
Hi Philip. I'm guessing you would want to use the time intelligence DAX function TOTALYTD to accomplish that scenario.
@shuha24
@shuha24 Жыл бұрын
Great content as usual. But I think this process is very memory intensive.
@jrin8927
@jrin8927 2 жыл бұрын
That's exactly what I'm looking for! Just one tiny thing... Is there any way to transform this formula to use it in a DirectQuery example? That would be awesome, thank you!
@510z2
@510z2 Жыл бұрын
If you are using Direct Query then you can create the column with SQL code using window functions
@macshock632
@macshock632 3 ай бұрын
This is cool! but what if i need the running total value showing up at certain dates (month End). How would I do that?
@surender665
@surender665 2 жыл бұрын
Hi please help me, how to calculate running total exclude current month
@rcarranzamanuel
@rcarranzamanuel 2 жыл бұрын
What happens if sales jumps from Nov to Jan, no dec information?
@dataanddailylife
@dataanddailylife Жыл бұрын
I want to do running totals by membership and loop for 12 months from the start date buy goods. How do this? Please help me.
@user-rb3py2dv4o
@user-rb3py2dv4o 6 ай бұрын
When I try to create a new column by following your process, it’s not letting me reference another column while defining the variable. Just shows a list of all existing measure. Please help because creating a custom column is not fun.
@allendataguy
@allendataguy Жыл бұрын
Why don't we use the formula "Rolling sales total = calculate(sum(Sales_table[sales]), Date_table[Date_column]
@atifhussain7935
@atifhussain7935 Жыл бұрын
How we can separate the agency "A" & Agency "B" in two columns instead of all value is in one running total column ??
@georgecook5120
@georgecook5120 Жыл бұрын
Shouldn't the Rolling Total column sum to 72? Since we are using a rolling total for each agency, it would be 38 + 34 = 72. Isn't this the correct answer?
@hristinabiserinska4388
@hristinabiserinska4388 2 жыл бұрын
Do you have a next video where you return the Date when reached certain running total amount? Or let me ask it as a more general question - how to calculate a median value of a dataset that is aggregated, meaning has frequencies - 10 times value X, 2 times value Y presented in 2 rows in a table, instead of 12 rows. Therefore, Median formula is not helpful. Thank you!
@christinelowery2415
@christinelowery2415 Жыл бұрын
What about running totals for items per dc per Region per week and per snapshot date? Whew that’s a lot to explain
@christinelowery2415
@christinelowery2415 Жыл бұрын
Forgot I need 4 weeks forward each time😊
@dianajimenez9574
@dianajimenez9574 8 ай бұрын
I get an error message that says, "a circular dependency was detected: EqAuditsReq[Column]. This is my code: Column = var CurrentMonth = EqAuditsReqRT[Month Number] var CurrentBranch = EqAuditsReqRT[Branch] var FilteredTable = FILTER(EqAuditsReqRT, EqAuditsReqRT[Month Number] = CurrentMonth && EqAuditsReqRT[Branch] = CurrentBranch) return CALCULATE(sum(EqAuditsReqRT[Equipment Audit Requirement]), FilteredTable) Can anyone help?
@petecardona8203
@petecardona8203 Жыл бұрын
So many formulas just for a simple row sum total? Easier in excel
@m3abadi404
@m3abadi404 Жыл бұрын
This will give wrong results fir repeated dates fir sam agency !!!
@christinelowery2415
@christinelowery2415 Жыл бұрын
Wouldn’t you sum the sales by grouping agency and date first?
@aryansena7290
@aryansena7290 4 ай бұрын
Total is not correct
5 Tips and Tricks for writing cleaner DAX in Power BI!! ❗❗
11:57
Pragmatic Works
Рет қаралды 7 М.
Fast Running Totals in Power Query (Complete Guide)
29:16
BI Gorilla
Рет қаралды 27 М.
A teacher captured the cutest moment at the nursery #shorts
00:33
Fabiosa Stories
Рет қаралды 51 МЛН
Alex hid in the closet #shorts
00:14
Mihdens
Рет қаралды 16 МЛН
Secret Experiment Toothpaste Pt.4 😱 #shorts
00:35
Mr DegrEE
Рет қаралды 35 МЛН
Running Total in Power BI (for Date and Non Date Values)
9:05
Power BI: Use DAX Switch Function to Make IF Functions Easier
10:37
Pragmatic Works
Рет қаралды 71 М.
DAX - Percent of Total vs Percent of Grand Total
9:06
Pragmatic Works
Рет қаралды 33 М.
Computing a running total in DAX
5:05
SQLBI
Рет қаралды 66 М.
No More DAX? Power BI’s NEW Feature Explained (File Included)
7:30
MyOnlineTrainingHub
Рет қаралды 59 М.
Power Query Running Totals - The Right Way!
11:53
MyOnlineTrainingHub
Рет қаралды 74 М.
A teacher captured the cutest moment at the nursery #shorts
00:33
Fabiosa Stories
Рет қаралды 51 МЛН