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!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
Hi,
I am new at this. I have 3 tables: Sales, Budget and a date table.
Through a slicer the user selects the years they want to see and in visuals they should have Sales for selected years and Budget only for the last year selected.
If they select 2020,2021 and 2022 it should display Sales in 2020,2021 and 2022 and Budget in 2022.
How do I write in DAX the formula to only calculate the sum of budget for the max year that was selected and if there is no budget set for that year to return 0?
This is my Date table:
Date =
VAR StartDate = DATE ( YEAR ( MIN ('Invoices'[Date]) ), 1,1)
VAR EndDate = DATE ( YEAR ( MAX ('Invoices'[Date] )), 12, 31)
return
ADDCOLUMNS(CALENDAR(
StartDate,
EndDate),
"DateAsInteger", FORMAT ( [Date], "YYYYMMDD" ),
"Year", YEAR ( [Date] ),
"MonthNo", FORMAT ( [Date], "MM" ),
"YearMonthNo", FORMAT ( [Date], "YYYY/MM" ),
"YearMonth", FORMAT ( [Date], "YYYY/mmm" ),
"MonthShort", FORMAT ( [Date], "mmm" ),
"MonthLong", FORMAT ( [Date], "mmmm" ),
"WeekNo", WEEKDAY ( [Date] ),
"WeekDay", FORMAT ( [Date], "dddd" ),
"WeekDayShort", FORMAT ( [Date], "dddd" ),
"Quarter", "Q" & FORMAT ( [Date], "Q" ),
"YearQuarter", FORMAT ( [Date], "YYYY" ) & "/Q" & FORMAT ( [Date],"Q" )
)
Your help is very much appreciated!
Solved! Go to Solution.
Try using this file and let me know if it solves https://drive.google.com/file/d/1AOSfnqSm1qPv6L2bg4VT8GFddb3bf6wW/view?usp=sharing
Proud to be a Super User!
Try using this file and let me know if it solves https://drive.google.com/file/d/1AOSfnqSm1qPv6L2bg4VT8GFddb3bf6wW/view?usp=sharing
Proud to be a Super User!
It worked! Thank you!
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 55 | |
| 53 | |
| 40 | |
| 17 | |
| 16 |
| User | Count |
|---|---|
| 123 | |
| 108 | |
| 44 | |
| 32 | |
| 26 |