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 everyone,
I have troubles building a measure in Power BI.
I calculated monthly expenditures on Power BI (I divided the whole amount per 12).
I want to have the year-to-date expenditures, calculated automatically when you choose the month.
The formula looks like that :
Year-to-date expenditures = [Monthly expenditures] * [Number of the month]
For example, in March, you multiple by 3.
I tried with VAR but it doesn't work.
This is what I wrote.
Thank you for your help.
Solved! Go to Solution.
@Anonymous
Try like
Ytd Expenditures =
VAR SelectedMonth = countX('Date 2', Values('Date 2'[Month Number]))
Return
CALCULATE([Monthly expenditures Cosmetics]*SelectedMonth)
Ytd Expenditures =
VAR SelectedMonth = MaxX('Date 2'('Date 2'[Month Number]))
Return
CALCULATE([Monthly expenditures Cosmetics]*SelectedMonth)
@Anonymous
Try like
Ytd Expenditures =
VAR SelectedMonth = countX('Date 2', Values('Date 2'[Month Number]))
Return
CALCULATE([Monthly expenditures Cosmetics]*SelectedMonth)
Ytd Expenditures =
VAR SelectedMonth = MaxX('Date 2'('Date 2'[Month Number]))
Return
CALCULATE([Monthly expenditures Cosmetics]*SelectedMonth)
The second one is working !!
Thank you very much 😍
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 39 | |
| 37 | |
| 33 | |
| 32 | |
| 29 |
| User | Count |
|---|---|
| 133 | |
| 88 | |
| 85 | |
| 68 | |
| 64 |