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

The FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now

Reply
UncleLewis
Responsive Resident
Responsive Resident

Error Cannot Convert Value of Type Text to Type True/False

Hi all,

Using up-to-date PBID.
This error confuses me since it refers to Year column which shows as whole number in power query.
What am I missing here?

Error:

Error fetching data for this visual
MdxScript(Model) (83,13) Calculation error in meausre 'Sales'(Selected Time Periods New]: Cannot convert value 'Year(s):' of type Text to type True/False.

 

PBIX is here

 

DAX:

Selected Time Periods New =

VAR _Div = 12

VAR _Rows_Months = COUNTROWS(VALUES(Calendar[Month]))

Var _Mod = MOD(_Rows_Months,_Div)

VAR _Rows_Quarters = COUNTROWS(VALUES(Calendar[Quarter]))

VAR _Rows_Years = COUNTROWS(VALUES('Calendar'[Year]))

VAR _Result =

    IF(

        _Mod = 0,

            "Year{s}: " &&

                CONCATENATEX(

                    VALUES('Calendar'[Year]),

                    FORMAT('Calendar'[Year],"0000"),

                    ", "

                ) && UNICHAR(10) &&

            "Quarter(s): " &&

                CONCATENATEX(

                    VALUES(Calendar[Quarter]),

                    Calendar[Quarter],

                    ", "

                ),

            "Year{s}: " &&

                CONCATENATEX(

                    VALUES('Calendar'[Year]),

                    FORMAT('Calendar'[Year],"0000"),

                    ", "

                ) && UNICHAR(10) &&

            "Quarter(s): " &&

                CONCATENATEX(

                    VALUES(Calendar[Quarter]),

                    Calendar[Quarter],

                    ", "

                ) && UNICHAR(10) &&

            "Month(s): " &&

                CONCATENATEX(

                    VALUES(Calendar[Month]),

                    Calendar[Month],

                    ", "

                )

    )

RETURN

    _Result





1 ACCEPTED SOLUTION
PhilipTreacy
Super User
Super User

@UncleLewis 

 

&& is the logical comparison AND, you should be using just a single & to join strings.

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

2 REPLIES 2
PhilipTreacy
Super User
Super User

@UncleLewis 

 

&& is the logical comparison AND, you should be using just a single & to join strings.

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Du-oh! (Homer)

Thanks Phil!

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.