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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Mahmoodul
Helper I
Helper I

How can i handle This Error

Here is my DAX but i am getting Error(dax comparison operations do not support comparing values of type text with values of type date), Van you please help me and correct my DAX.
Report Date is type Date and country_level1 is Type Text.
 
Calls_6 Week % =
VAR actual =
DIVIDE(
[Calls_6 Weeks],
CALCULATE(
[Calls_Total],
FILTER(
ALL(ocb_global_misses_master_pkg),
ocb_global_misses_master_pkg[country_level1]=VALUE(ocb_global_misses_master_pkg[country_level1]) &&
ocb_global_misses_master_pkg[report_date] = VALUE(ocb_global_misses_master_pkg[report_date]))),
0)
RETURN
actual
1 ACCEPTED SOLUTION
v-janeyg-msft
Community Support
Community Support

Hi, @Mahmoodul 

 

vjaneygmsft_1-1638238051553.png

The usage of 'value': Converts a text string that represents a number to a number. Obviously you can't use it for data type data. You can use values and selectedvalue instead.

Like this:

Calls_6 Week % =
VAR actual =
    DIVIDE (
        [Calls_6 Weeks],
        CALCULATE (
            [Calls_Total],
            FILTER (
                ALL ( ocb_global_misses_master_pkg ),
                ocb_global_misses_master_pkg[country_level1]
                    = SELECTEDVALUE ( ocb_global_misses_master_pkg[country_level1] )
                    && ocb_global_misses_master_pkg[report_date]
                        = SELECTEDVALUE ( ocb_global_misses_master_pkg[report_date] )
            )
        ),
        0
    )
RETURN
    actual

Reference:

VALUES function (DAX) - DAX | Microsoft Docs

SELECTEDVALUE function - DAX | Microsoft Docs

 

Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please feel free to ask me.


Best Regards,
Community Support Team _ Janey

View solution in original post

2 REPLIES 2
v-janeyg-msft
Community Support
Community Support

Hi, @Mahmoodul 

 

vjaneygmsft_1-1638238051553.png

The usage of 'value': Converts a text string that represents a number to a number. Obviously you can't use it for data type data. You can use values and selectedvalue instead.

Like this:

Calls_6 Week % =
VAR actual =
    DIVIDE (
        [Calls_6 Weeks],
        CALCULATE (
            [Calls_Total],
            FILTER (
                ALL ( ocb_global_misses_master_pkg ),
                ocb_global_misses_master_pkg[country_level1]
                    = SELECTEDVALUE ( ocb_global_misses_master_pkg[country_level1] )
                    && ocb_global_misses_master_pkg[report_date]
                        = SELECTEDVALUE ( ocb_global_misses_master_pkg[report_date] )
            )
        ),
        0
    )
RETURN
    actual

Reference:

VALUES function (DAX) - DAX | Microsoft Docs

SELECTEDVALUE function - DAX | Microsoft Docs

 

Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please feel free to ask me.


Best Regards,
Community Support Team _ Janey

vanessafvg
Super User
Super User

The issue is most likely this line, 

 

ocb_global_misses_master_pkg[report_date] = VALUE(ocb_global_misses_master_pkg[report_date]

 

you are using a text function with a date, and you can't do that.  What are you trying to do?  Why not just compare  the 2 dates?

 

 





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.