Forum Discussion
Anonymous
3 years agoNot applicable
DAx Measure error Concatenate
Hi Experts
I cannot see where my error is on the following DAX - the end result should bu (Canada),(Italy);[004],[005]
Measure 2 =
VAR _CountryStore = "(Cananda),(Italy);[004],[005]"
VAR SeparatorPosition = SEARCH(";",_CountryStore)
VAR Country = LEFT(_CountryStore, SeparatorPosition - 1)
VAR Store = RIGHT(_CountryStore , SeparatorPosition + 1)
RETURN
CONCATENATE(Country, CONCATENATE("(",CONCATENATE(Store,")"))
)
RIGHT starts counting from the end of the text, not the beginning. Try
Measure2 = VAR _CountryStore = "(Cananda),(Italy);[004],[005]" VAR SeparatorPosition = SEARCH ( ";", _CountryStore ) VAR _Length = LEN ( _CountryStore ) VAR _Country = LEFT ( _CountryStore, SeparatorPosition - 1 ) VAR _Store = MID ( _CountryStore, SeparatorPosition + 1, _Length - SeparatorPosition ) RETURN CONCATENATE ( _Country, CONCATENATE ( "(", CONCATENATE ( _Store, ")" ) ) )
4 Replies
- johnt75Super User
RIGHT starts counting from the end of the text, not the beginning. Try
Measure2 = VAR _CountryStore = "(Cananda),(Italy);[004],[005]" VAR SeparatorPosition = SEARCH ( ";", _CountryStore ) VAR _Length = LEN ( _CountryStore ) VAR _Country = LEFT ( _CountryStore, SeparatorPosition - 1 ) VAR _Store = MID ( _CountryStore, SeparatorPosition + 1, _Length - SeparatorPosition ) RETURN CONCATENATE ( _Country, CONCATENATE ( "(", CONCATENATE ( _Store, ")" ) ) )- AnonymousNot applicable
Hi Johnt75 - thanks for the feedback slight error end result need to be
(Canada),(Italy);[004],[005] - see image of current result - AnonymousNot applicable
Worked it out - thanks
- AnonymousNot applicable
Hi Johnt75 - could you kindly help with
https://community.powerbi.com/t5/Desktop/DAX-Measure-error-to-remove-fixed-values-with-table-column/m-p/3202654#M1078365