Using Variables in DAX – A Detailed Example

No comments

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 – Power BI Resources

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s