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 Power Users,
I'm struggling with some dax measures. I have 2 slicers from Date table ( Year and Month). I would like to create measures for Month(First Day of the month-Last Day of the month), YeartoCurrentMonth( First Day of the year - Last day of the month) and TotalYear(First Day of the year - Last day of the Year).
If the user selects Year-2022 and Month-June or 6 in the slicers then i need to calculate Openorders.
| Current Month Orders | 6/1/22 - 6/30/22 |
| Current Year upto current month Orders | 1/1/22 - 6/30/22 |
| Whole Current year Orders | 1/1/22 - 12/31/22 |
Please help me with the calculation.
Thanks,
Solved! Go to Solution.
Hi,
Please check the attached pbix file below.
I tried to create a sample pbix file, and the data model looks like the below.
All measures are in the attached pbix file.
Current month orders: =
VAR _currentyear =
MAX ( 'Calendar'[Year] )
VAR _currentmonth =
MAX ( 'Calendar'[Month] )
VAR _lastdateofthemonth =
CALCULATE (
MAX ( 'Calendar'[Date] ),
FILTER (
ALL ( 'Calendar' ),
'Calendar'[Year] = _currentyear
&& 'Calendar'[Month] = _currentmonth
)
)
VAR _periodtable =
FILTER (
ALL ( 'Calendar' ),
'Calendar'[Date] <= _lastdateofthemonth
&& 'Calendar'[Year] = _currentyear
&& 'Calendar'[Month] = _currentmonth
)
RETURN
CALCULATE ( SUM ( Data[Order] ), _periodtable )
Current year upto current month orders: =
VAR _currentyear =
MAX ( 'Calendar'[Year] )
VAR _currentmonth =
MAX ( 'Calendar'[Month] )
VAR _lastdateofthemonth =
CALCULATE (
MAX ( 'Calendar'[Date] ),
FILTER (
ALL ( 'Calendar' ),
'Calendar'[Year] = _currentyear
&& 'Calendar'[Month] = _currentmonth
)
)
VAR _periodtable =
FILTER (
ALL ( 'Calendar' ),
'Calendar'[Date] <= _lastdateofthemonth
&& 'Calendar'[Year] = _currentyear
)
RETURN
CALCULATE ( SUM ( Data[Order] ), _periodtable )
Current year all orders: =
VAR _currentyear =
MAX ( 'Calendar'[Year] )
VAR _lastdateoftheyear =
CALCULATE (
MAX ( 'Calendar'[Date] ),
FILTER (
ALL ( 'Calendar' ),
'Calendar'[Year] = _currentyear
)
)
VAR _periodtable =
FILTER (
ALL ( 'Calendar' ),
'Calendar'[Date] <= _lastdateoftheyear
&& 'Calendar'[Year] = _currentyear
)
RETURN
CALCULATE ( SUM ( Data[Order] ), _periodtable )
Hi,
Please check the attached pbix file below.
I tried to create a sample pbix file, and the data model looks like the below.
All measures are in the attached pbix file.
Current month orders: =
VAR _currentyear =
MAX ( 'Calendar'[Year] )
VAR _currentmonth =
MAX ( 'Calendar'[Month] )
VAR _lastdateofthemonth =
CALCULATE (
MAX ( 'Calendar'[Date] ),
FILTER (
ALL ( 'Calendar' ),
'Calendar'[Year] = _currentyear
&& 'Calendar'[Month] = _currentmonth
)
)
VAR _periodtable =
FILTER (
ALL ( 'Calendar' ),
'Calendar'[Date] <= _lastdateofthemonth
&& 'Calendar'[Year] = _currentyear
&& 'Calendar'[Month] = _currentmonth
)
RETURN
CALCULATE ( SUM ( Data[Order] ), _periodtable )
Current year upto current month orders: =
VAR _currentyear =
MAX ( 'Calendar'[Year] )
VAR _currentmonth =
MAX ( 'Calendar'[Month] )
VAR _lastdateofthemonth =
CALCULATE (
MAX ( 'Calendar'[Date] ),
FILTER (
ALL ( 'Calendar' ),
'Calendar'[Year] = _currentyear
&& 'Calendar'[Month] = _currentmonth
)
)
VAR _periodtable =
FILTER (
ALL ( 'Calendar' ),
'Calendar'[Date] <= _lastdateofthemonth
&& 'Calendar'[Year] = _currentyear
)
RETURN
CALCULATE ( SUM ( Data[Order] ), _periodtable )
Current year all orders: =
VAR _currentyear =
MAX ( 'Calendar'[Year] )
VAR _lastdateoftheyear =
CALCULATE (
MAX ( 'Calendar'[Date] ),
FILTER (
ALL ( 'Calendar' ),
'Calendar'[Year] = _currentyear
)
)
VAR _periodtable =
FILTER (
ALL ( 'Calendar' ),
'Calendar'[Date] <= _lastdateoftheyear
&& 'Calendar'[Year] = _currentyear
)
RETURN
CALCULATE ( SUM ( Data[Order] ), _periodtable )
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 59 | |
| 43 | |
| 42 | |
| 23 | |
| 17 |
| User | Count |
|---|---|
| 190 | |
| 122 | |
| 96 | |
| 66 | |
| 47 |