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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
answeriver
Helper IV
Helper IV

Error cannot convert value of type text to type true false

hello all,

Can yo please explain logic of error.

 

Measure is:

= CALCULATE(DISTINCTCOUNT(REPORT_IMS[SALEPOINT CODE]))/CALCULATE(DISTINCTCOUNT(REPORT_IMS[SALEPOINT CODE]),ALLEXCEPT(REPORT_IMS,'REPORT_IMS'[CITY],REPORT_IMS[REGION (groups)],REPORT_IMS[VISIT MONTH]),REPORT_IMS[VISIT YEAR],'Attributes','Attributes'[type contract])
 
So i have two table/ Relationship between its salepoint code. First table report ims it's sales and second table is Attributes. My measure need to calculate distribution of some product from all universe (reports IMS), from one of type contract and other. But when i add in the measure 'Attributes','Attributes'[type contract] i see the erorr 
1 ACCEPTED SOLUTION
Pragati11
Super User
Super User

HI @answeriver ,

 

  • First thing is try to use DIVIDE dax function to do your calculation.
  • Break-down your measure to variables
  • I think the sytax error is on your ALLEXCEPT function. You have closed the bracket for this function too early.

Your syntax error is somehwere in this part of DAX:

ALLEXCEPT(
                   REPORT_IMS'REPORT_IMS'[CITY]REPORT_IMS[REGION (groups)]REPORT_IMS[VISIT MONTH]
                 ), // you have closed the ALLEXCEPT clause here

REPORT_IMS[VISIT YEAR],'Attributes','Attributes'[type contract] // this is the line with error I guess

 

Question for you: What you are trying to achieve here with the line of code above?

 

You will have to correct your DAX something like this:

= CALCULATE(
            DISTINCTCOUNT(REPORT_IMS[SALEPOINT CODE])
           )
/
CALCULATE(
          DISTINCTCOUNT(REPORT_IMS[SALEPOINT CODE]), 
          ALLEXCEPT( 
                    REPORT_IMS, 'REPORT_IMS'[CITY], REPORT_IMS[REGION (groups)], 
                    REPORT_IMS[VISIT MONTH], REPORT_IMS[VISIT YEAR]
                   ), 
         ALLEXCEPT(
                   'Attributes','Attributes'[type contract]
                  )
        )

 

Check if the above DAX works. Make sure to write your DAX as clean as possible - specially the closing and opening brackets.

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

View solution in original post

4 REPLIES 4
answeriver
Helper IV
Helper IV

@Pragati11  can you help me in this?

HI @answeriver ,

 

Please create a new thread for this if this is something different to the syntax error issue that you raised.

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Pragati11
Super User
Super User

HI @answeriver ,

 

  • First thing is try to use DIVIDE dax function to do your calculation.
  • Break-down your measure to variables
  • I think the sytax error is on your ALLEXCEPT function. You have closed the bracket for this function too early.

Your syntax error is somehwere in this part of DAX:

ALLEXCEPT(
                   REPORT_IMS'REPORT_IMS'[CITY]REPORT_IMS[REGION (groups)]REPORT_IMS[VISIT MONTH]
                 ), // you have closed the ALLEXCEPT clause here

REPORT_IMS[VISIT YEAR],'Attributes','Attributes'[type contract] // this is the line with error I guess

 

Question for you: What you are trying to achieve here with the line of code above?

 

You will have to correct your DAX something like this:

= CALCULATE(
            DISTINCTCOUNT(REPORT_IMS[SALEPOINT CODE])
           )
/
CALCULATE(
          DISTINCTCOUNT(REPORT_IMS[SALEPOINT CODE]), 
          ALLEXCEPT( 
                    REPORT_IMS, 'REPORT_IMS'[CITY], REPORT_IMS[REGION (groups)], 
                    REPORT_IMS[VISIT MONTH], REPORT_IMS[VISIT YEAR]
                   ), 
         ALLEXCEPT(
                   'Attributes','Attributes'[type contract]
                  )
        )

 

Check if the above DAX works. Make sure to write your DAX as clean as possible - specially the closing and opening brackets.

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Thank you Pragati11.

My fault with ). Actualy i need to count count of salepoint code devide on total salepoint cod with filters ALLEXCEPT. Measure from you is working without errors, but filter "type contract" whatever don't showing needs results.

Measure 5 = CALCULATE(DISTINCTCOUNT(REPORT_IMS[SALEPOINT CODE]))/CALCULATE(DISTINCTCOUNT(REPORT_IMS[SALEPOINT CODE]),ALLEXCEPT(REPORT_IMS,'REPORT_IMS'[CITY],REPORT_IMS[REGION (groups)],REPORT_IMS[VISIT MONTH],REPORT_IMS[VISIT YEAR],REPORT_IMS[UNIVERSE]),ALLEXCEPT(Attributes,Attributes[Type of Contract]))
Measure 7 = CALCULATE(DISTINCTCOUNT(REPORT_IMS[SALEPOINT CODE]))
Measure 8 = CALCULATE(DISTINCTCOUNT(REPORT_IMS[SALEPOINT CODE]),ALLEXCEPT(REPORT_IMS,'REPORT_IMS'[CITY],REPORT_IMS[REGION (groups)],REPORT_IMS[VISIT MONTH],REPORT_IMS[VISIT YEAR],REPORT_IMS[UNIVERSE]),ALLEXCEPT(Attributes,Attributes[Type of Contract]))Capture1.JPG

Capture.JPG

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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.