Forum Discussion
Problem with calcul
- 7 months ago
Hi FP68
here the correct code
ApplicationName =VAR TagText = Disques_Global[TAGS]VAR _Key = "ApplicationName="VAR KeyPos = SEARCH ( _Key, TagText, 1, 0 )VAR ValueStart = KeyPos + LEN ( Key )VAR SemiPos = SEARCH ( ";", TagText, ValueStart, 0 )RETURNIF (KeyPos = 0,BLANK(),IF (SemiPos = 0,MID ( TagText, ValueStart, LEN ( TagText ) - ValueStart + 1 ),MID ( TagText, ValueStart, SemiPos - ValueStart )))If this helped, please consider giving kudos and mark as a solution
@me in replies or I'll lose your threadWant to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page
Consider voting this Power BI idea
Francesco Bergamaschi
MBA, M.Eng, M.Econ, Professor of BI
hi FP68 ,
In "_y = Disques_Global[Countries2] - _x", could _y be negative?
Negative arguments in MID could lead to such error.
Hi
No _y couldn't be negative
- FreemanZ7 months agoSuper User
in Countries2, should it be like:
SemiColonPos = SEARCH ( ";" , [TAGS] , _z , 0 ) + _z- FP687 months agoHelper I
No SemiColonPos is the posiion of ";" after the word ApplicationName
- FreemanZ7 months agoSuper User
with ".......;ApplicationName=.......;.....", could you confirm the comments in red:
Countries2 =
VAR _x = SEARCH ( "ApplicationName=" , [TAGS] , 1 , 0 )
VAR _z = _x + LEN ( "ApplicationName=" )
VAR SemiColonPos = SEARCH ( ";" , [TAGS] , _z , 0 )
RETURN SemiColonPos //returns 8?
ApplicationName =
var _x = find("ApplicationName",[TAGS],1,0) //_x returns 9?
var _y = Disques_Global[Countries2] - _x //_y return -1?
var _z = MID (Disques_Global[Tags], _x,_y)
return _z