Forum Discussion
Fantmas
Helper III
2 years agoDAX Calculation do not show me total in table visual
Hi Everyone, I am facing an issue, I create a measure to solve a business case to compare if the value of cat A is greater than cat B in 2024 if not then I have to calculate the difference between...
- Anonymous2 years ago
Hi Fantmas ,
I made an attempt and you can check the results below:
Measure = var _select = SELECTEDVALUE('Time'[Year]) var _A = CALCULATE(SUM('Table'[Value]),FILTER('Table',[Year]=_select&& [category]="A")) var _B = CALCULATE(SUM('Table'[Value]),FILTER('Table',[Year]=_select&& [category]="B")) var _preB = CALCULATE(SUM('Table'[Value]),FILTER('Table',[Year]=_select -1 && [category]="B")) RETURN IF(_A>_B,"Yes",ABS(_B-_preB))An attachment for your reference. Hope it helps!
Best regards,
Community Support Team_ Scott ChangIf this post helps then please consider Accept it as the solution to help the other members find it more quickly.
Fantmas
Helper III
2 years agoHi amit,
Thank you for your feedback and I found that my measure is not correct,
My goal is to calculate in a table with Year, Category, Product and Value the Sum of Value for 2023 for the product in category which have there value greater than the value for product in category B in 2024
I am struggeling a while and I do not know how to do it
Below a quick sample of my table
| Year | category | Product | Value |
| 2023 | A | Apple | 1 |
| 2023 | A | Banana | 1 |
| 2023 | A | Orange | 1 |
| 2023 | A | Lemon | 1 |
| 2023 | B | Apple | 1 |
| 2023 | B | Banana | 1 |
| 2023 | B | Orange | 1 |
| 2023 | B | Lemon | 1 |
2024 | A | Apple | 0.9 |
| 2024 | A | Banana | 0.7 |
| 2024 | A | Orange | 0.8 |
| 2024 | A | Lemon | 0.9 |
| 2024 | B | Apple | 1 |
| 2024 | B | Banana | 0.5 |
| 2024 | B | Orange | 0.8 |
| 2024 | B | Lemon | 0.5 |
Thanks for your help