Forum Discussion
Sudharsanan
Helper III
4 years agoSum data based on product availability by comparing years.
Hi All,
Can someone help me with the below scenerio?
I wanted to sum the price when the product is available on both 2022 and 2021? is this something we can get using DAX?
Appreciate your support!!
Result = VAR _filter = INTERSECT( CALCULATETABLE(VALUES('Table'[Customer]),'Table'[Year] = 2021), CALCULATETABLE(VALUES('Table'[Customer]),'Table'[Year] = 2022) ) RETURN CALCULATE( SUM('Table'[Price]), 'Table'[Year] = 2021, _filter )
10 Replies
- SpartaBI
Community Champion
Sudharsanan what is the result you want to get in the measure?
25 + 35 + 45 ? or also the valus from 2022? 5, 10 and 20? - Sudharsanan
Helper III
SpartaBI i need 25+35+45 from 2021 alone
- SpartaBI
Community Champion
Result = VAR _filter = INTERSECT( CALCULATETABLE(VALUES('Table'[Customer]),'Table'[Year] = 2021), CALCULATETABLE(VALUES('Table'[Customer]),'Table'[Year] = 2022) ) RETURN CALCULATE( SUM('Table'[Price]), 'Table'[Year] = 2021, _filter )- Sudharsanan
Helper III
SpartaBI I am getting the below error and not able to get the answer..can you help me with it?