Forum Discussion
In a matrix, add variance column with arrows
Hi everyone,
I saw a lot of similar demands on the forum, but everything I tried never gives me the expected result, so I finally ask for help, can you please help me ?
My datas are like (simplified for explanation):
| ID | Activity | Week number |
| 456 | Level 2 | Week 2 |
| 478 | Level 2 | Week 1 |
| 248 | Level 3 | Week 1 |
| 210 | Level 3 | Week 2 |
| 1174 | Level 2 | Week 2 |
| 5855 | Level 3 | Week 2 |
| 147 | Level 2 | Week 1 |
| ... | ... | ... |
I created a basic matrix like this :
| Activty | Week 1 | Week 2 |
| Level 2 | 1050 | 980 |
| Level 3 | 35 | 43 |
My goal is to add one column, called "Variance" by example, showing a down or up arrow depending of the variance between Week 1 and Week 2.
So with the example it would be :
| Activty | Week 1 | Week 2 | Variance |
| Level 2 | 1050 | 980 | โ๏ธ |
| Level 3 | 35 | 43 | โ๏ธ |
It seems simple but I don't succeed, either it adds a column per week, or the result is incoherent...
Thanks per advance for your help
2 Replies
- Grogu69Frequent Visitor
I found a solution by creating a measure by value and for the variance (which I transform in arrows with conditionnal formating), I doubt it's the best solution so if you have better to propose, don't hesitate please
But at least I'm not stuck anymore ๐
- Sahir_Maharaj
Super User
Hello Grogu69,
1. Add a calculated column to calculate the variance between Week 1 and Week 2
Variance = [Week 2] - [Week 1]2. Add a new column to your matrix visual, and set its data field to the Variance column
3. Format the new column as an image by going to the Format pane, selecting the new column, and then setting the Data Label property to Image URL
4. Use DAX to return the URL of the appropriate arrow image based on the value of the Variance column
Arrow URL = IF([Variance] < 0, "https://image.flaticon.com/icons/svg/271/271220.svg", IF([Variance] > 0, "https://image.flaticon.com/icons/svg/271/271224.svg", "https://image.flaticon.com/icons/svg/271/271232.svg"))5. Set the Image URL property of the data label to the Arrow URL expression.
6. Hide the Variance column from the visual by going to the Format pane, selecting the Variance column, and then setting the Data Label property to None.
I hope this helps!