Named Calculation expressions

Written by: | Posted on:

Just a quick note on Name Calculations in SSAS, they need to be written in whatever SQL dialect the underlying DB engine (probably MS-SQL) understands. I wanted to make a Sales Margin calculation, and to avoid a Divide by Zero where sale price was zero, my code for this was:
<br /> CASE<br /> WHEN Sale<>0 THEN (Sale-Cost)/Sale<br /> ELSE 0<br /> END<br />
Never before have I needed four lines to do a simple IF. ;-)

Image Image

Father, husband, software developer, musician and photographer.

Get to know what I'm up to


© 2020 Niklas Saers Contact Me