Forum Discussion
Anonymous
7 years agoNot applicable
Measure Conditional
Hello, I need to calculate in the same measure the following problem: I have prices for 2018 and 2019, and in the same measure, I need to calculate the quatity*prices for 2018 if the date i...
Anonymous
7 years agoNot applicable
Hi Mariusz ,
I did it just right now.
I just did a lot of ifs with calculates...
IF(sum('table'[date]<DATE[yyyy;mm;dd);
(IF(SUM('Tabela Categoria'[CAT_2])=1;CALCULATE(SUM('Table Sales'[Sales Price]);'Table Sales'[Year]=2018);IF(SUM('Tabela Categoria'[CAT_2])=2;CALCULATE(SUM('Table Sales'[Sales Price]);'Table Sales'[Year]=2018);IF(SUM('Tabela Categoria'[CAT_2])=3;CALCULATE(SUM('Table Sales'[Sales Price]);'VTable Sales'[Year]=2018)))));(IF(SUM('Tabela Categoria'[CAT_2])=1;CALCULATE(SUM('Table Sales'[Sales Price]);'Table Sales'[Year]=2019);IF(SUM('Tabela Categoria'[CAT_2])=2;CALCULATE(SUM('Table Sales'[Sales Price]);'Table Sales'[Year]=2019);IF(SUM('Tabela Categoria'[CAT_2])=3;CALCULATE(SUM('Table Sales'[Sales Price]);'Table Sales'[Year]=2019)))))
Do you believe you know a easier way?
Thank you for your feedback.
Cmcmahan
7 years agoResident Rockstar
There definitely is an easier way, but it depends on how your data is modeled. Could you share a sample of the raw data with us so we can see how it is set up in your data table?
Also, if you could share a mockup of your desired visual as well, that would help too. It looks like you're trying to control and account for every possible category/year combination instead of letting your visual handle the context changes for you.