Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
Hi all,
We are trying to create a calculation group in Analysis Service (Visual Studio 2019) with the following calculation item:
Yn-3= CALCULATE(SELECTEDMEASURE(),(YEAR(dates_master_data_gold[Fechas])=(YEAR(TODAY())-3)))
This formula can be saved as a measure, but when we try to create the calculation item it loses its formula properties when writing an "=". See the images below for a better understanding:
The result is an incorrect formula. When we try to write it in tabular editor, it works fine. ¿Does anybody know how to manage the "=" in calculation items for Visual Studio? Couldn't find any information related to this error.
Thank you in advance.
@MCMM
You may try storing it in a veriable
VAR YnLess3 =
CALCULATE (
SELECTEDMEASURE (),
(
YEAR ( dates_master_data_gold[Fechas] )
= YEAR ( TODAY () ) - 3
)
)
RETURN
YnLess3
Hi @tamerj1 ,
Since we are using an = operator right after VAR, this formula stops working as you can see below:
We tried to look for another way of using "equal" operator such as: EQ , == , EQUAL... but none have worked so far and the sign "=" seems to be forbidden in calculation items (don't know why since you can use it in measures without any trouble). We have worked with calculation groups previously in tabular editor when our data model was stored in Power BI. But now we are working over Analysis Services and even if we try to write it down in Tabular Editor, the modifications won't be saved in the AS model.
Thanks anyway for your support and if you have any other suggestions we would be glad to hear them.
Hi @MCMM ,
Ideal way to create a measure in tabular editor is like below. It required ":=" instead "=".
Yn-3 := CALCULATE(SELECTEDMEASURE(),(YEAR(dates_master_data_gold[Fechas])=(YEAR(TODAY())-3)))
Thanks,
Samarth
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
Yeah, I know.
We are trying to create a calculation item, not a measure.
Thank you.
Hi:
This is not specific to your '=' question, but can you get this to work?
CALCULATE( SELECTEDMEASURE() , DATEADD( 'Date'[Date], - 3, YEAR )
Hope this helps..
Hi @Whitewater100 ,
This formula gets all data for the last 3 years and we only want to display the ones related to year N-3 (15Millions):
We also need to create another calculation items and the one related to current year, has to retrieve data from two different sources depending on the month (real data + forecasted). I'm not sure how to achieve this without using the "=" sign.
Just a guess, try putting an equal sign at the beginning of the code or try provide the name before this equal sign.
Hi @tamerj1 ,
If the sentence starts with "=", Power BI gets the following error when trying to display the calculation view:
Same thing happens if we try to name the calculation item like "NAME:="
Do you have any other idea?
Thanks anyway.
User | Count |
---|---|
12 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
25 | |
19 | |
14 | |
8 | |
7 |