Forum Discussion
Dynamic value computation
Yes this can be done. First thing we need to do is create a "Key" field. Best place to do this is part of the import, but we could also do this as a calculated column in Dax. All you need to do is use the code "[User] & [Device]". The code is similar for Power Query and Dax in this regard.
Once you have the key column, you can create a label measure that looks like this:
Output Text = if(
DISTINCTCOUNT(TestData[Key]) > 1,
"Both",
FIRSTNONBLANK(TestData[Device], TestData[Device])
)
- nakul04908 years agoFrequent Visitor
Hey,
Many Thanks for the solution, it worked..
is there also a way to count on the output text the number of users? i tried doing it but it just uses the "Both" category
- Anonymous8 years agoNot applicable
Are you able to rephrase your question? I'm not really sure what you means. Do you mean one of these:
Output Text = if( DISTINCTCOUNT(TestData[Key]) > 1, "Both (" & COUNT(TestData[User]) & ")", FIRSTNONBLANK(TestData[Device], TestData[Device]) )Output Text = if( DISTINCTCOUNT(TestData[Key]) > 1, "Both (" & DISTINCTCOUNT(TestData[User]) & ")", FIRSTNONBLANK(TestData[Device], TestData[Device]) )- nakul04908 years agoFrequent Visitor
Hey,
Thanks a lot for looking into it again :),
I am actually trying to draw a pie chart showing number of users falling in each category - "Both", "Desktop" & "Mobile"
like:
Type Count
Both 2
Desktop 1
Mobile 1
and if I use the second code mentioned by you separately in addition to the classification of category like :
Type = if(DISTINCTCOUNT(Tabelle1[Key])>1,"Both",FIRSTNONBLANK(Tabelle1[Device],Tabelle1[Device]))
Count = if(DISTINCTCOUNT(Tabelle1[Key])>1, DISTINCTCOUNT(Tabelle1[User]),DISTINCTCOUNT(Tabelle1[User]))
i get the result as
User Type Count
A Desktop 1
B Both 1
but this table is not helping me in plotting the chart to indicate total users in each category.