Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi All,
Is there any way in DAX to split values and show them as calculated? as I don't want to change in my Data Model.
Please guide.
Problem:
Requirement:
Regards
Solved! Go to Solution.
Hi @danyal1990 ,
Not sure about how you would like to split the rows “Value-2:Value-1”, so I do it by random. You may need do a little change to the following DAX formula to fulfill your needs.
Here are the sample data used.
Create a Calculated column to complete the split.
Split =
VAR rows_need_split =
CALCULATE (
COUNT ( 'Table'[Response] ),
CONTAINSSTRING ( 'Table'[Response], ":" )
)
VAR mid_ =
RAND()* rows_need_split
VAR half = rows_need_split / 2
VAR res =
IF (
mid_ > 0
&& mid_ <= half,
LEFT ( 'Table'[Response], 7 ),
MID ( 'Table'[Response], 9, 8 )
)
RETURN
IF ( CONTAINSSTRING ( 'Table'[Response], ":" ), res, 'Table'[Response] )
And use the Calculated column above to create the visual. The result will look like this.
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!
Best Regards,
Community Support Team _ Caiyun
Hi @danyal1990 ,
Not sure about how you would like to split the rows “Value-2:Value-1”, so I do it by random. You may need do a little change to the following DAX formula to fulfill your needs.
Here are the sample data used.
Create a Calculated column to complete the split.
Split =
VAR rows_need_split =
CALCULATE (
COUNT ( 'Table'[Response] ),
CONTAINSSTRING ( 'Table'[Response], ":" )
)
VAR mid_ =
RAND()* rows_need_split
VAR half = rows_need_split / 2
VAR res =
IF (
mid_ > 0
&& mid_ <= half,
LEFT ( 'Table'[Response], 7 ),
MID ( 'Table'[Response], 9, 8 )
)
RETURN
IF ( CONTAINSSTRING ( 'Table'[Response], ":" ), res, 'Table'[Response] )
And use the Calculated column above to create the visual. The result will look like this.
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!
Best Regards,
Community Support Team _ Caiyun
Manage it based on what? There must be some criteria
Yes, I just want to split the Response and want DAX to calculate the Responses as shown in picture.
I just edited the picture on my own not done any calculation.
Should we need to do a Group By or anything else? guide please
Thanks
Hi @danyal1990
Is this a simple count? How did you know that 2 goes for Value2 and 1 goes for Value1?
Hi tamerj1,
Yes, currently it is simple count of the response.
If we split this response through DAX then it will automatically manage it or we need to change it?
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
41 | |
21 | |
21 | |
14 | |
14 |
User | Count |
---|---|
42 | |
39 | |
33 | |
19 | |
18 |