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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors