Forum Discussion
Scatter Plot - Overlapping of data labels
- Anonymous2 years ago
Hi Vijay08V ,
I made some changes on your code, we tried to use a tighter jitter control and then removed the MOD function, which allows each value to be randomly distributed and non-repeating.Actual Points (with Random number added) = VAR BaseValue = MAX( [Actual Points]) VAR Minvalue = SWITCH( TRUE(), BaseValue < 1, 0, BaseValue < 2, 1, BaseValue < 3, 2, 0 ) VAR MaxValue = SWITCH( TRUE(), BaseValue < 1, 1, BaseValue < 2, 2, BaseValue < 3, 3, 3 ) VAR Jitter = RANDBETWEEN(1, 10) / 100 VAR AdjustedValue = BaseValue + Jitter RETURN MIN(MAX(AdjustedValue, Minvalue), MaxValue)But this time, the random value of 0 will only be changed from 0 to 0.1, not from 0 to 1.
We can try to specify each value and then do a random number assignment.
Actual Points (with Random number added) = VAR BaseValue = MAX('Table'[Actual Points]) VAR Minvalue = SWITCH(TRUE(), BaseValue <1,0, BaseValue <2 ,1, BaseValue <3,2,0) VAR MaxValue = SWITCH(TRUE(), BaseValue<1,1, BaseValue < 2, 2, BaseValue < 3, 3,3) VAR Jitter = SWITCH( TRUE(), BaseValue = 0, RANDBETWEEN(1, 100) / 100, BaseValue < 1, RANDBETWEEN(-10, 10) / 100, BaseValue < 2, RANDBETWEEN(1, 10) / 100, BaseValue < 3, RANDBETWEEN(5, 15) / 100 ) VAR AdjustedValue = BaseValue + Jitter RETURN MIN(MAX(AdjustedValue, Minvalue), MaxValue)If you have any other questions, you can check out the PBIX file I've shared, I hope it helps you with your question!
Hope it helps!
Best regards,
Community Support Team_ Tom ShenIf this post helps then please consider Accept it as the solution to help the other members find it more quickly.
Hello Anonymous
Thank you for sharing the Pbix file. However in the snapshot if you see Item A10 has actual points (with Random) as 1.01 but it shouldn't exceed the range of 0 to 1. Also, item A13 to A16 still get the same Actual points (with Random)
Hi Vijay08V ,
I'm sorry it didn't quite do what you wanted, Dax doesn't plan 1 as between 0 and 1. We can add some more filters to help randomise the distribution of the number three.
Actual Points (with Random number added) =
VAR BaseValue = MAX('Table'[Actual Points])
VAR Minvalue =
SWITCH(
TRUE(),
BaseValue = 0, 0,
BaseValue <=1, 0,
BaseValue <2, 1,
BaseValue <3, 2,
BaseValue <4, 3,
0
)
VAR MaxValue =
SWITCH(
TRUE(),
BaseValue = 0, 1,
BaseValue <=1, 1,
BaseValue <2, 2,
BaseValue <3, 3,
BaseValue <4, 4,
4
)
VAR Jitter =
SWITCH(
TRUE(),
BaseValue = 0, RANDBETWEEN(1, 100) / 100,
BaseValue <=1, RANDBETWEEN(-20, 0) / 100,
BaseValue <2, RANDBETWEEN(1, 10) / 100,
BaseValue <3, RANDBETWEEN(1, 10) / 100,
BaseValue <4, RANDBETWEEN(1, 100) / 100,
0
)
VAR AdjustedValue = BaseValue + Jitter
RETURN
MIN(MAX(AdjustedValue, Minvalue), MaxValue)
Hope it helps!
Best regards,
Community Support Team_ Tom Shen
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.