Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hello,
I'd like to create a matrix for car expenses and visualize it by year on the X-axis. This should be based on a calculation using the [Date purchase] from the DIM_CARS table.
I've attached a sample file along with the expected outcome.
Could someone please assist me in setting up this matrix in Power BI?
Thank you in advance for your help!
https://drive.google.com/file/d/1SKa9fK--bUFhsFPA0tqQhNKVi_R1tJS6/view?usp=sharing
https://drive.google.com/file/d/1bLG8F_ntbHAIRVWvy0_6T3IzciUGAtN7/view?usp=sharing
Solved! Go to Solution.
Hi @Ronald123 ,
Try the following:
Total Costs car =
VAR Depreciation =
FILTER (
SUMMARIZE (
'FACT_DEPRECIATION FINANCIAL',
DIM_CARS[Registration],
DIM_CARS[Date purchase],
'FACT_DEPRECIATION FINANCIAL'[DATE],
'FACT_DEPRECIATION FINANCIAL'[Amount],
"_Years", DATEDIFF ( DIM_CARS[Date purchase], 'FACT_DEPRECIATION FINANCIAL'[DATE], YEAR )
),
[_Years] = [Years Value]
)
VAR maintenance =
FILTER (
SUMMARIZE (
FACT_MAINTAINCE,
DIM_CARS[Registration],
DIM_CARS[Date purchase],
FACT_MAINTAINCE[DATE],
FACT_MAINTAINCE[Amount],
"_Years", DATEDIFF ( DIM_CARS[Date purchase], FACT_MAINTAINCE[DATE], YEAR )
),
[_Years] = [Years Value]
)
RETURN
SUMX ( Depreciation, 'FACT_DEPRECIATION FINANCIAL'[Amount] )
+ SUMX ( maintenance, FACT_MAINTAINCE[Amount] )
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi @Ronald123 ,
Try the following:
Total Costs car =
VAR Depreciation =
FILTER (
SUMMARIZE (
'FACT_DEPRECIATION FINANCIAL',
DIM_CARS[Registration],
DIM_CARS[Date purchase],
'FACT_DEPRECIATION FINANCIAL'[DATE],
'FACT_DEPRECIATION FINANCIAL'[Amount],
"_Years", DATEDIFF ( DIM_CARS[Date purchase], 'FACT_DEPRECIATION FINANCIAL'[DATE], YEAR )
),
[_Years] = [Years Value]
)
VAR maintenance =
FILTER (
SUMMARIZE (
FACT_MAINTAINCE,
DIM_CARS[Registration],
DIM_CARS[Date purchase],
FACT_MAINTAINCE[DATE],
FACT_MAINTAINCE[Amount],
"_Years", DATEDIFF ( DIM_CARS[Date purchase], FACT_MAINTAINCE[DATE], YEAR )
),
[_Years] = [Years Value]
)
RETURN
SUMX ( Depreciation, 'FACT_DEPRECIATION FINANCIAL'[Amount] )
+ SUMX ( maintenance, FACT_MAINTAINCE[Amount] )
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsThe Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 41 | |
| 38 | |
| 36 | |
| 31 | |
| 28 |
| User | Count |
|---|---|
| 129 | |
| 88 | |
| 79 | |
| 68 | |
| 63 |