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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
RvdHeijden
Post Prodigy
Post Prodigy

Converting Data type to True/False

I need some help, ive been trying on my own but i cant get it to work.

 

I have a Date table using the CALENDAR function and now i have a formula that converts the dates into workindays with this formula.


Weekday =
IF (
    OR (WEEKDAY ('Date'[Date]) = 1; WEEKDAY ('Date'[Date] ) = 7 );
    FALSE;
    TRUE
)

 

i use this formula in other tables and it works however i cant seem to be able to convert this form 'Tekst' to 'True/False'.
It returns an error stating that it can't convert to a True/False type.

The result is that my formula in another table returns another error because of the error.

DAX comparison operations do not support comparing values of type Text with values of type True/False. Consider using the VALUE or FORMAT function to convert one of the values.

Doorlooptijd Ticket = VAR DIFF =
    CALCULATE (
        COUNTROWS ( 'Date' );
        ALL ( 'Date' );
        DATESBETWEEN (
            'Date'[Date];
            Tickets[Ticketstart];
            IF ( ISBLANK ( Tickets[Ticketstop]); TODAY (); Tickets[Ticketstop] )
        );
        'Date'[Weekday] = TRUE()
    )
RETURN
    IF ( DIFF = 1; 1; DIFF)

1 ACCEPTED SOLUTION

Strange; after I switched Windows to Nederlands (Nederland) it works with me: take look at this 23 sec video.

Just like WeekdayMB = MOD(WEEKDAY('Date'[Date]);6)<>1

Specializing in Power Query Formula Language (M)

View solution in original post

8 REPLIES 8
MFelix
Super User
Super User

Hi @RvdHeijden,

 

In your formula the format of the results aren't equal try doing this change

Doorlooptijd Ticket = VAR DIFF =
    CALCULATE (
        COUNTROWS ( 'Date' );
        ALL ( 'Date' );
        DATESBETWEEN (
            'Date'[Date];
            Tickets[Ticketstart];
            IF ( ISBLANK ( Tickets[Ticketstop]); TODAY (); Tickets[Ticketstop] )
        );
        'Date'[Weekday] = TRUE()
    )
RETURN
    IF ( DIFF = "1"; 1; DIFF)

 

making the 1 into text should work

 

Regards,

MFelix

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



@MFelix

Thanks for your help but the error remains the same.

 

I think that the error is being triggered by the fact that the 'red' part of the formula refurs to a formula that has the data type of 'Tekst' where it should be 'True/False' but i can't seem to convert that colum.

 

Your change in the formula had no effect im afraid

Try this

 

  IF ( FORMAT(DIFF;"#") = "1"; 1; DIFF)


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



@MFelix

Sorry, still the same error

 

Doorlooptijd Ticket = VAR DIFF =
    CALCULATE (
        COUNTROWS ( 'Date' );
        ALL ( 'Date' );
        DATESBETWEEN (
            'Date'[Date];
            Tickets[Ticketstart];
            IF ( ISBLANK ( Tickets[Ticketstop]); TODAY (); Tickets[Ticketstop] )
        );
        'Date'[Weekday] = TRUE()
    )
RETURN
   IF ( FORMAT(DIFF;"#") = "1"; 1; DIFF)

Maybe:

 

Weekday =
IF (
    OR (WEEKDAY ('Date'[Date]) = 1; WEEKDAY ('Date'[Date] ) = 7 );
    FALSE();
    TRUE()
)

Specializing in Power Query Formula Language (M)

@MarcelBeug

Sorry, no effect.

That formula already worked but the data type is wrong, its set to 'Tekst' but i cannot convert it to 'True/False'.

I believe that if i can change that the other formula will work.

 

Its either that or change the other formula so that it can coop with tekst values instead of true/false

Strange; after I switched Windows to Nederlands (Nederland) it works with me: take look at this 23 sec video.

Just like WeekdayMB = MOD(WEEKDAY('Date'[Date]);6)<>1

Specializing in Power Query Formula Language (M)

@MarcelBeug

The funny thing is that ive added a new column (like i did multiple times before) and now the formula works and the formula is in the right data format.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.