563 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owls only (no freelancers)
Almost no cancellations
We have genuine integrity
We invoice after training
Review 30+ years of Wise Owl
View our top 100 clients
Search our website
We also send out useful tips in a monthly email newsletter ...
Learn how to create calculated columns in a tabular model using DAX Part two of a three-part series of blogs |
---|
Creating calculated columns in tabular models is deceptively similar to creating formulae in Excel. Deceptively, because the underlying language (DAX) is completely different, and you can make use of functions like SWITCH which have no Excel equivalent. This blog shows what calculated columns are, and how to create them.
This blog is part of our online SSAS Tabular tutorial; we also offer lots of other Analysis Services training resources. |
Suppose that you want to be able to aggregate transaction volumes by the year in which they occur:
We'll create a column to show the month corresponding to any particular date.
Note that this is actually a bad idea, as it would be much better to do this using a calendar, but a) we haven't covered them in this blog yet and b) this would ruin a nice simple example!
To start with, click on the function wizard tool:
Click on the tool shown here.
To help you choose the right function, choose a category (it's usually pretty obvious what this should be):
Choose this category to find a function giving the year for any given date.
Find the function you want, and double-click on it:
Often it isn't as obvious as this!
SSAS Tabular puts the function name in your formula:
You can now complete the formula by choosing the PosDate field:
Here's the final formula you should get:
I've renamed the column too.
For the final part of this blog, I'll show how you can make choices using the IF or the SWITCH functions.
Parts of this blog |
---|
|
Some other pages relevant to the above blogs include:
Kingsmoor House
Railway Street
GLOSSOP
SK13 2AA
Landmark Offices
99 Bishopsgate
LONDON
EC2M 3XD
Holiday Inn
25 Aytoun Street
MANCHESTER
M1 3AE
© Wise Owl Business Solutions Ltd 2023. All Rights Reserved.