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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.

Top Kudoed Authors