Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
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)
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 57 | |
| 40 | |
| 36 | |
| 19 | |
| 18 |
| User | Count |
|---|---|
| 70 | |
| 69 | |
| 38 | |
| 35 | |
| 23 |