Forum Discussion
DAX help needed
| id | product | product_id | amount | s_id |
| 100-4024449860 | 3 | 0 | 1,9 | 10668506 |
| 100-4024449860 | 3 | 0 | 1,9 | 10668868 |
| 100-4024449860 | 3 | 0 | 1,9 | 10670033 |
| 100-4023063296 | 2 | 0 | 0 | 199334 |
| 100-4023063321 | 2 | 0 | 2,7 | 1866829 |
| 100-4023063351 | 2 | 0 | 5,8 | 78233 |
| 100-4023063537 | 2 | 0 | 0,8 | 199336 |
| 100-4023063906 | 2 | 1 | 21 | 1889161 |
| 100-4023063997 | 2 | 1 | 1,4 | 1984698 |
| 100-4023064113 | 2 | 1 | 5,5 | 1992505 |
| 100-4023064143 | 2 | 1 | 0 | 77493 |
| 100-4023064155 | 2 | 1 | 10,9 | 10037981 |
| 100-4023064180 | 2 | 1 | 18,4 | 1994162 |
| 100-4023064180 | 2 | 1 | 2,7 | 2015940 |
| 100-4023064180 | 2 | 2 | 3,2 | 2034646 |
| 100-4023064287 | 2 | 2 | 1,3 | 10613124 |
| 100-4023064570 | 2 | 2 | 1,7 | 182786 |
| 100-4023064570 | 2 | 2 | 1,7 | 183063 |
| 100-4023064735 | 2 | 2 | 5,5 | 1994150 |
| 100-4023064946 | 2 | 2 | 4,6 | 10289201 |
| 100-4023065082 | 2 | 2 | 4,9 | 10038215 |
| 100-4023065082 | 2 | 2 | 1,7 | 10038252 |
| 100-4023065116 | 2 | 2 | 0,4 | 10037979 |
| 100-4023065148 | 2 | 2 | 0,7 | 199364 |
| 100-4023065287 | 2 | 2 | 0,6 | 199356 |
| 100-4023065356 | 2 | 2 | 2,2 | 10607848 |
| 100-4023065360 | 2 | 2 | 1,2 | 183745 |
| 100-4023065604 | 2 | 0 | 0,6 | 10036460 |
| 100-4023065850 | 2 | 1 | 0,6 | 34275 |
lbendlin , can you pls try this data?
Your sample data only has Product IDs 2 and 3 but the DAX explicitly calls out IDs 0 and 1. Please clarify.
How many rows are in your actual table?
This article is likely relevant for your issue: https://www.sqlbi.com/articles/all-the-secrets-of-summarize/
- Anonymous2 years agoNot applicable
Hi lbendlin , I have fixed the sample data, can you try with new one, and my main point in the dax query is I want to find total sales based on id,product and during calculation there is if condition and it should provide different topn strategy according to product_id.
- lbendlin2 years agoSuper User
I still don't understand the business logic. What are you trying to achieve?
- Anonymous2 years agoNot applicable
well I have got performance issue and I have checked that article as well, but when i change it to addcolumns it is returning different value, so I want to optimize the query.
- lbendlin2 years agoSuper User
Doesn't this make more sense?
- Anonymous2 years agoNot applicable
I have tried but it didnt return same value, do you think why?