Don't miss your chance to take exam DP-600 or DP-700 on us!
Request nowLearn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Hello everyone,
I'm not sure if I'm my dax variable is correct but I need a year picker (slicer). I need date picker when a user pick a year it will calculate the picked year + 1 and the first day of the following year. Example it means when a user pick year 2021 , dax will return to the date 01/01/2022.
I created this one :
Solved! Go to Solution.
Hi @Anonymous
Based on your needs, I have created the following table.
Using the formula you provided, the result will always return 1/1/1901.
You only need to make slight modifications to your Dax to achieve your needs:
M2 =
var SelectedYear = YEAR(SELECTEDVALUE('Table'[Date]))
RETURN
DATE(SelectedYear+1, 1, 1)
Result:
Best Regards,
Jayleny
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous
Based on your needs, I have created the following table.
Using the formula you provided, the result will always return 1/1/1901.
You only need to make slight modifications to your Dax to achieve your needs:
M2 =
var SelectedYear = YEAR(SELECTEDVALUE('Table'[Date]))
RETURN
DATE(SelectedYear+1, 1, 1)
Result:
Best Regards,
Jayleny
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous
Has your problem been resolved? If so, could you share your solution so that others with similar issues can benefit from it?
Best Regards,
Jayleny
Hello, @Anonymous
this measure is essentially fine, depends what you wanna do with it.
I recommend using physical columns for Year (just for clarity) instead of Date.Year.
If you mark your calendar as Date Table, you should lose this option anyway.
then it depends on your exact measure what you wanna achieve.
you can have something like this:
Measure =
var _year = SELECTEDVALUE('Calendar'[Year])+1
CALCULATE(
SUM('Table'[idk]),
'Calendar'[Year] = _year
)
Hi @Anonymous
Use the below dax:
PendingCasesCount411 =
VAR SelectedYear = SELECTEDVALUE('Calendar'[Date].[Year])
VAR FirstDayOfNextYear = DATE(SelectedYear + 1, 1, 1)
RETURN
COUNTROWS(
FILTER(
CecCaseDetail,
VAR TopEvent =
TOPN(
1,
FILTER(
CecCaseEvent,
CecCaseEvent[CecCaseID] = CecCaseDetail[CaseID] &&
CecCaseEvent[ToStateOfProceedingID] <> CecCaseEvent[FromStateOfProceedingID] &&
CecCaseEvent[EventDate] < FirstDayOfNextYear
),
CecCaseEvent[EventOrder],
DESC
)
VAR SopBeforeDate =
IF(
NOT ISEMPTY(TopEvent),
SELECTCOLUMNS(TopEvent, "ToStateOfProceedingID", CecCaseEvent[ToStateOfProceedingID])
)
RETURN
SopBeforeDate IN {2, 3, 4}
)
)
@Anonymous try adding ALL(CecCaseEvent) to the measure.
FILTER(
ALL(CecCaseEvent),
CecCaseEvent[CecCaseID] = CecCaseDetail[CaseID] &&
CecCaseEvent[ToStateOfProceedingID] <> CecCaseEvent[FromStateOfProceedingID] &&
CecCaseEvent[EventDate] < FirstDayOfNextYear
)
btw you can send me sample file (post link from onedrive/google) and I can work on it directly.
sure I sent you email
I need data that will get all before 01/01/2022, sorry I mentioned it.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 54 | |
| 47 | |
| 39 | |
| 16 | |
| 15 |
| User | Count |
|---|---|
| 83 | |
| 71 | |
| 39 | |
| 29 | |
| 27 |