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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

Conversion Issue

Hi Microsoft Team,

 

I am getting an error as follows
"Cannot Convert value 'Australia' of type text to type True/false.

 

The measure is as follows:

Comparable Left =
Var _a_left_value=CALCULATE([SP], FILTER('Store',Store[RUName]))
return
_a_left_value

Note:  [SP] is a measure 

Help me to overcome that error


1 ACCEPTED SOLUTION
v-kkf-msft
Community Support
Community Support

Hi @Anonymous ,

 

Suppose you need to retrieve the following table using those filters.

 

vkkfmsft_0-1647937753030.png


If the table has created relationships with other tables, then you can filter directly. 

 

vkkfmsft_2-1647937830606.png

 

 

If there is no relationship between theses tables, please create the following measure.

 

Measure = 
CALCULATE (
    [SP],
    FILTER (
        'Table 2',
        'Table 2'[Date] IN ALLSELECTED ( 'Date'[Date] )
            && 'Table 2'[item] = SELECTEDVALUE ( 'Item'[itemName] )
            && 'Table 2'[Product] = SELECTEDVALUE ( 'Product'[ProductName] )
            && 'Table 2'[RU] = SELECTEDVALUE ( Store[RUName] )
    )
)

Screenshot 2022-03-22 163638.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

6 REPLIES 6
v-kkf-msft
Community Support
Community Support

Hi @Anonymous ,

 

Suppose you need to retrieve the following table using those filters.

 

vkkfmsft_0-1647937753030.png


If the table has created relationships with other tables, then you can filter directly. 

 

vkkfmsft_2-1647937830606.png

 

 

If there is no relationship between theses tables, please create the following measure.

 

Measure = 
CALCULATE (
    [SP],
    FILTER (
        'Table 2',
        'Table 2'[Date] IN ALLSELECTED ( 'Date'[Date] )
            && 'Table 2'[item] = SELECTEDVALUE ( 'Item'[itemName] )
            && 'Table 2'[Product] = SELECTEDVALUE ( 'Product'[ProductName] )
            && 'Table 2'[RU] = SELECTEDVALUE ( Store[RUName] )
    )
)

Screenshot 2022-03-22 163638.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

truptis
Community Champion
Community Champion

Hi @Anonymous ,

Try this:

Comparable Left = var selection = Selectedvalue(Store[RUName])
Var _a_left_value=CALCULATE([SP]FILTER('Store',Store[RUName]=selection ))
return
_a_left_value
 
@Anonymous -> Please mark this as a solution & hit the thumbs up if it helps you. Thanks.
Anonymous
Not applicable

Hi Truptis,

 

After trying the below code also, 
Comparable Left = var selection = Selectedvalue(Store[RUName])
I was getting this error ""Cannot Convert value 'Australia' of type text to type True/false."


Any other logic please?

Aditya_Meshram
Solution Supplier
Solution Supplier

Hi @Anonymous 
you need to complete this filter condition here 

Aditya_Meshram_2-1647501967778.png

something like FILTER('Store',Store[RUName] = "Australia") etc. or whatever filter condition you want to put here.

Regards,
Aditya

Anonymous
Not applicable

Hi Aditya,
It should pick dynamically like = Selectedvalue(Store[RUName])
When I am giving as above it was throwing same error like conversion issue

Anonymous
Not applicable

Hi Aditya,
I have few tables - Date, Store, Item , product tables

From Date Table - Date(YEAR), Date(Month)
From Store Table - Store(RUName)

From Item Table - Item(itemName)
From Product Table - Product(ProductName)
And Now I have one Measure ie., [SP]

I am trying to retrieve the [SP] data with all above filter values 

Can I get some logic , how I can pass all those filters in DAX

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors