Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreShape the future of the Fabric Community! Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions. Take survey.
Hello Experts,
Could you please help me with this issue?
I have a table with monthly sales by Year/Month, like this
product code | description | year | Jan | feb | Mar | Apr | May | jun | Jul | Aug | Sep | Oct | Nov | Dec |
M01 | Product A | 2019 | 10 | 12 | 22 | 32 | 12 | 10 | 56 | 23 | 60 | 65 | 90 | 98 |
M01 | Product A | 2020 | 8 | 15 | 16 | 18 | 25 | 54 | 24 | 65 | 89 | 120 | 100 | 125 |
M02 | Product B | 2019 | 3 | 13 | 25 | 21 | 17 | 87 | 98 | 34 | 54 | 26 | 43 | 55 |
M02 | Product B | 2020 | 15 | 32 | 54 | 56 | 76 | 54 | 56 | 43 | 22 | 90 | 18 | 130 |
Then, I need generate a new row below each product with the Variation 2020 minus 2019 for each month.
Something like this:
I tried using a matrix, but it only make a sum of the values for each month, Is possible change it to generate a row with variation 2020 minus 2019?..
Solved! Go to Solution.
@gomezc73 - Put together a more concrete example for you with your data. The quick measure basically discusses the concept of how to do it, how to use HASONEVALUE, ISINSCOPE, etc. to find out where you are in the hierarchy/matrix and then you can decide how to do your calculation accordingly. See attached PBIX beneath sig. Page 6, Table (6), Measure 6.
Measure 6 =
VAR __productcode = MAX([product code])
VAR __description = MAX([description])
VAR __year = MAX([year])
VAR __Month = MAX([Attribute])
VAR __2019 = SUMX(FILTER(ALL('Table (6)'),[product code]=__productcode && [description]=__description && [Attribute]=__Month && [year]=2019),[Value])
VAR __2020 = SUMX(FILTER(ALL('Table (6)'),[product code]=__productcode && [description]=__description && [Attribute]=__Month && [year]=2020),[Value])
RETURN
IF(ISINSCOPE([year]),SUM([Value]),__2020 - __2019)
@gomezc73 - You want MM3TR&R - https://community.powerbi.com/t5/Quick-Measures-Gallery/Matrix-Measure-Total-Triple-Threat-Rock-amp-...
Thanks fot your help, It can help is very similar. but i am not an expert user.. Sorry!!. Is very complicated to modified the formula to generated the difference insted MIN/Max or AVE?
@gomezc73 - Put together a more concrete example for you with your data. The quick measure basically discusses the concept of how to do it, how to use HASONEVALUE, ISINSCOPE, etc. to find out where you are in the hierarchy/matrix and then you can decide how to do your calculation accordingly. See attached PBIX beneath sig. Page 6, Table (6), Measure 6.
Measure 6 =
VAR __productcode = MAX([product code])
VAR __description = MAX([description])
VAR __year = MAX([year])
VAR __Month = MAX([Attribute])
VAR __2019 = SUMX(FILTER(ALL('Table (6)'),[product code]=__productcode && [description]=__description && [Attribute]=__Month && [year]=2019),[Value])
VAR __2020 = SUMX(FILTER(ALL('Table (6)'),[product code]=__productcode && [description]=__description && [Attribute]=__Month && [year]=2020),[Value])
RETURN
IF(ISINSCOPE([year]),SUM([Value]),__2020 - __2019)
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Check out the November 2024 Power BI update to learn about new features.
User | Count |
---|---|
92 | |
89 | |
83 | |
77 | |
49 |
User | Count |
---|---|
146 | |
137 | |
109 | |
68 | |
55 |