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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
MaleneL
Helper II
Helper II

Expressions that yield variant data-type cannot be used to define calculated columns

Hi all

I am working on at DAX formular to get the stage for the last day last year, but I get the above message.

the formular is 

Stadie EOY =

VAR _StadieEOY =
    CALCULATE(
        FIRSTNONBLANK(Fact_DWH[Stage_Name],1),
            FILTER(
                Fact_DWH,
                Fact_DWH[FBK_Date#Int#EndOfMonth] = 'Fact_DWH'[FBK_Date#Int#EndOfYear]
                    && Fact_DWH[Customer] = 'Fact_DWH'[Customer]))
Return
if(ISBLANK(_StadieEOY),0,_StadieEOY)
How can i work around that the stage Name is not at numer?

CustomerFBK_Date#Int#EndOfMonthFBK_Date#Int#EndOfYearStage_Namestage EOY LY
128-02-202331-12-20221b??
228-02-202331-12-20222c??
328-02-202331-12-20223d??
428-02-202331-12-20222c??
528-02-202331-12-20221b??
131-12-202231-12-20213d??
231-12-202231-12-20212c??
331-12-202231-12-20211b??
431-12-202231-12-20211b??
531-12-202231-12-20212c??

 

hope you can help

Malene

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hi @MaleneL 

The type of value you want to return is Text type, but the number type returned by 0 in the if statement you defined, the two returned value types are different, so an error will be reported, you can refer to the following new expression

Stadie EOY = 
 var  _StadieEOY=CALCULATE(
        FIRSTNONBLANK(Fact_DWH[Stage_Name],1),
            FILTER(
                Fact_DWH,
                Fact_DWH[FBK_Date#Int#EndOfMonth] = EARLIER('Fact_DWH'[FBK_Date#Int#EndOfYear])
                    && Fact_DWH[Customer] = EARLIER('Fact_DWH'[Customer])))
return IF(ISBLANK(_StadieEOY),"None",_StadieEOY)

vxinruzhumsft_0-1688349050967.png

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

thanks it worked ;O)

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @MaleneL 

The type of value you want to return is Text type, but the number type returned by 0 in the if statement you defined, the two returned value types are different, so an error will be reported, you can refer to the following new expression

Stadie EOY = 
 var  _StadieEOY=CALCULATE(
        FIRSTNONBLANK(Fact_DWH[Stage_Name],1),
            FILTER(
                Fact_DWH,
                Fact_DWH[FBK_Date#Int#EndOfMonth] = EARLIER('Fact_DWH'[FBK_Date#Int#EndOfYear])
                    && Fact_DWH[Customer] = EARLIER('Fact_DWH'[Customer])))
return IF(ISBLANK(_StadieEOY),"None",_StadieEOY)

vxinruzhumsft_0-1688349050967.png

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

thanks it worked ;O)

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.

Top Solution Authors