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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
RvdHeijden
Post Prodigy
Post Prodigy

Need help correcting my Formula

Hello,

 

Ive got a formula that needs some work, there are a lot of IF's in

 

Status Schouw = IF(OR(Adressen[R.N.A.]="R40";(Adressen[R.N.A.]="R42"));"";
    IF(Adressen[Civiel geplande datum]=BLANK();"Civiel nog niet gepland";
        IF(Adressen[schouwen begin]=BLANK();"Schouw nog niet gepland";
            IF(OR(Adressen[schouwen gesloten]=BLANK();(Adressen[schouwen begin]<>BLANK()));"Bulkplanning";
                IF(OR(Adressen[schouwen gesloten]=BLANK();(Adressen[Schouw datum]<NOW()));"Te laat";
                    IF(Adressen[schouwen gesloten]<>BLANK();"Gesloten";
                        IF(MID(Adressen[schouwen begin];14;18)<>"00:00";"Vaste afspraak";
                            IF(SUMX(adressen;Adressen[Civiel geplande datum]-NOW())<21;"Te Laat";""))))))))

 

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

 

I believe the error is caused in the last line because he needs to calculate the number of days between 2 colums and if its less then 21 days it should return the value 'Te laat'

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@RvdHeijden,

There is no issue with the last line when I make a test using sample data in my table. Could you please check that if you change the data type of Schouw datum field to Date? If this field is a text field, the above error will occur because you are comparing text values with date values in the following part. Also ensure that you have defined the data type of the Civiel geplande datum field to Date.

Adressen[Schouw datum]<NOW()

If the above step doesn't help, please share sample data of your table for us to test.

Regards,
Lydia

View solution in original post

3 REPLIES 3
danextian
Super User
Super User

hi @RvdHeijden,

 

Your formula seems fine but you could display it a in a neater way using Daxformatter.com

 

Status Schouw =
IF (
    OR ( Adressen[R.N.A.] = "R40"; ( Adressen[R.N.A.] = "R42" ) );
    "";
    IF (
        Adressen[Civiel geplande datum] = BLANK ();
        "Civiel nog niet gepland";
        IF (
            Adressen[schouwen begin] = BLANK ();
            "Schouw nog niet gepland";
            IF (
                OR (
                    Adressen[schouwen gesloten] = BLANK ();
                    ( Adressen[schouwen begin] <> BLANK () )
                );
                "Bulkplanning";
                IF (
                    OR (
                        Adressen[schouwen gesloten] = BLANK ();
                        ( Adressen[Schouw datum] < NOW () )
                    );
                    "Te laat";
                    IF (
                        Adressen[schouwen gesloten] <> BLANK ();
                        "Gesloten";
                        IF (
                            MID ( Adressen[schouwen begin]; 14; 18 ) <> "00:00";
                            "Vaste afspraak";
                            IF (
                                SUMX ( adressen; Adressen[Civiel geplande datum] - NOW () )
                                    < 21;
                                "Te Laat";
                                ""
                            )
                        )
                    )
                )
            )
        )
    )
)




Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

@danextian@Anonymous

Ive changed a few date colums because 2  were indeed referring to a tekst value.

They looked like dates but they were the outcome of a formula and the data type was set to 'tekst'.

 

So problem solved....thanks 🙂

Anonymous
Not applicable

@RvdHeijden,

There is no issue with the last line when I make a test using sample data in my table. Could you please check that if you change the data type of Schouw datum field to Date? If this field is a text field, the above error will occur because you are comparing text values with date values in the following part. Also ensure that you have defined the data type of the Civiel geplande datum field to Date.

Adressen[Schouw datum]<NOW()

If the above step doesn't help, please share sample data of your table for us to test.

Regards,
Lydia

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors