Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello Team,
I have a question, because this appears kind of strange to me. Probably there's a good explanation for this, but i don't see it.
I have added a column with IsInPreviousNYears([Customer_Modified_On],8 ) which is a date-type column.
However on a date of 23-2-2021 it returns FALSE. I would expect TRUE as it was in the Previous 8 Years.
Does anybody have an idea what goes wrong here?
Solved! Go to Solution.
Hi, @JeroenHD
Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
Table:
You may add a new step with the following m codes.
= Table.AddColumn(#"Changed Type", "Custom", each let
end = Date.From(DateTime.LocalNow()),
start = Date.AddYears(end,-8)
in
[Date]>=start and [Date]<=end)
Result(Today is 3/4/2021):
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @JeroenHD
Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
Table:
You may add a new step with the following m codes.
= Table.AddColumn(#"Changed Type", "Custom", each let
end = Date.From(DateTime.LocalNow()),
start = Date.AddYears(end,-8)
in
[Date]>=start and [Date]<=end)
Result(Today is 3/4/2021):
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @JeroenHD ,
"Note that this function will return false when passed a value that occurs within the current year."
https://docs.microsoft.com/en-us/powerquery-m/date-isinpreviousnyears
i solved it in Dax now, but i am still curious if anyone can help me figure out what the deal is in Power Query.
User | Count |
---|---|
11 | |
8 | |
5 | |
5 | |
4 |
User | Count |
---|---|
16 | |
14 | |
8 | |
6 | |
6 |