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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

Top Kudoed Authors