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
FC_USER
New Member

Cannot convert value '' of type Text to type Integer.

I want to create a waterfall chart based on two selected years.

When comparing the results of 2019 and 2020, I want to sum the number of data before 2019 and add the data added in 2020.

I want to get all the data before 2019, but when I enter the function below, an error "Cannot convert value '' of type Text to type Integer." is displayed. Why is this?

 

wtf_test = CALCULATE(COUNTROWS(yozai),FILTER(yozai,yozai[last_action_date] < dateTable[selectedYears]))

 

FC_USER_1-1673846881981.png

----------------------------------------------------------------

FC_USER_2-1673846936496.png

------------------------------------------------------------------------

FC_USER_3-1673846963272.png

 

1 ACCEPTED SOLUTION
Mahesh0016
Super User
Super User

@FC_USER ,
selectedyear = DATE(CONVERT(MID(CONCATENATEX(VALUES(DateTable[Column]),[Column],""),5,8),INTEGER),1,1)

@FC_USER If this post helps, please consider accept as solution to help other members find it more quickly and Appreciate your Kudos.

View solution in original post

4 REPLIES 4
Mahesh0016
Super User
Super User

@FC_USER ,
selectedyear = DATE(CONVERT(MID(CONCATENATEX(VALUES(DateTable[Column]),[Column],""),5,8),INTEGER),1,1)

@FC_USER If this post helps, please consider accept as solution to help other members find it more quickly and Appreciate your Kudos.

@Mahesh0016 

Thanks.But The result did not

Do you know how to keep later years from multiple selected years in slicer as values for comparison?

 

wtf_前年度繰越 = 
CALCULATE(COUNTROWS(yozai),FILTER(yozai,yozai[last_action_date] < dateTable[selectedyear]))

 

 

FC_USER_0-1673852068319.png

 

 

@FC_USER 

Please Try this one , if you compare multiple Year Selected 

wtf_前年度繰越 = 
CALCULATE(COUNTROWS(yozai),FILTER(yozai,yozai[last_action_date] IN {dateTable[selectedyear]}))


 

I get that same error...

If you give the date directly, it will show the value

 

MdxScript(Model) (42, 39) Calculation error on measure 'dateTable'[selectedyear]: value '' of type Text cannot be converted to type Integer.

 

FC_USER_0-1673864651267.png

ーーーーーーーーーーーーーーーーーーー

FC_USER_1-1673864988993.png

 

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.