Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
MCMM
Frequent Visitor

Equal sign "=" error in Visual Studio calculation group

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:

 

MCMM_1-1650297933438.png

MCMM_2-1650297947859.png

MCMM_3-1650297979984.png

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.

 

 

8 REPLIES 8
tamerj1
Super User
Super User

@MCMM 
You may try storing it in a veriable 

VAR YnLess3 =
    CALCULATE (
        SELECTEDMEASURE (),
        (
            YEAR ( dates_master_data_gold[Fechas] )
                = YEAR ( TODAY () ) - 3
        )
    )
RETURN
    YnLess3



MCMM
Frequent Visitor

Hi @tamerj1 ,

 

Since we are using an = operator right after VAR, this formula stops working as you can see below:

MCMM_0-1650437648494.png

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.

Samarth_18
Community Champion
Community Champion

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.

Whitewater100
Solution Sage
Solution Sage

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):

MCMM_1-1650353818915.png

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.

tamerj1
Super User
Super User

@MCMM 

Just a guess, try putting an equal sign at the beginning of the code or try provide the name before this equal sign. 

MCMM
Frequent Visitor

Hi @tamerj1 ,

 

If the sentence starts with "=", Power BI gets the following error when trying to display the calculation view:

MCMM_0-1650352274322.png

Same thing happens if we try to name the calculation item like "NAME:="

Do you have any other idea?

 

Thanks anyway.

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.