Forum Discussion
Building a Matrix with Asymmetrical Columns and Rows in Power BI
Hi migueldfr ,
Thanks for ToddChitt's reply!
And migueldfr ,
Which will show up the diference between year(today) - year(today) -1 for each quarter and anothe column with the difference in % (variance)
Are you trying to calculate the difference between two adjacent years in the same quarter?
If yes, please try to use these two DAXs to create calculated columns:
difference =
VAR _Year = [Year]
VAR _Quarter = [Quarter]
VAR _Current =
CALCULATE(
SUM('Table'[Total Importe Encargo]),
ALL('Table'),
'Table'[Year] = _Year && 'Table'[Quarter] = _Quarter
)
VAR _Previous =
CALCULATE(
SUM('Table'[Total Importe Encargo]),
ALL('Table'),
'Table'[Year] = _Year - 1 && 'Table'[Quarter] = _Quarter
)
VAR _MINYear =
CALCULATE(
MIN('Table'[Year]),
ALL('Table')
)
RETURN
IF(
'Table'[Year] = _MINYear,
0,
_Current - _Previous
)variance =
VAR _Year = [Year]
VAR _Quarter = [Quarter]
VAR _Currentdifference = [difference]
VAR _Previous =
CALCULATE(
SUM('Table'[Total Importe Encargo]),
ALL('Table'),
'Table'[Year] = _Year - 1 && 'Table'[Quarter] = _Quarter
)
VAR _MINYear =
CALCULATE(
MIN('Table'[Year]),
ALL('Table')
)
RETURN
IF(
'Table'[Year] = _MINYear,
0,
_Currentdifference / _Previous
)
And the final output is as below:
Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Good afternoon everyone.
Following the last example I am doing some new features and seem like I am getting there, but sadly I left something.
I have created a matrix with the Quarter and Years
Also I added a Total of sales, Difference between Quarters (from each year) and Variance (%)
As a final result, I would like to create a Matrix with Year on the top and Quarter on the Left side...
At the moment, I have this:
Thank you for any help you could bring to me
I would appreaciate