Variables are a real game-changer for the formula bar in Power BI. Being able to break down your more complex formulas in steps makes setting them out that much more intuitive. I keep thinking back to using VBA with these variables. They make your life in VBA about ten times easier – and the same can be said for using them within Power BI.
There are a few nuances to using them which I cover in this video tutorial.
The big one to get your head around is the context considerations of placing either calcs or other expressions inside a variable. Really understanding this well takes a bit of trial and error, so make sure to dive into it.
Variables within the formula bar are also very flexible. They can take in other expressions (or measures) as well as table functions, including filters. When you use filters a lot, these can take up a bit of room and your formulas can get messy, so being able to place these table functions in a variable is a great idea.
I go into a detailed example in the video so I’ll leave it there, but I highly recommend learning the syntax of variables and implementing these in your models as soon as you can. You will learn DAX much faster.
***** Learning Power BI? *****
All Enterprise DNA TV Resources
FREE COURSE – Ultimate Beginners Guide To Power BI
FREE COURSE – Ultimate Beginners Guide To DAX
FREE – 60 Page DAX Reference Guide Download
FREE – Power BI Resources
Enterprise DNA Membership
Enterprise DNA Online