Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
I'm making a custom column and what it populated with 2020 and another with 2019.
How do I define this year and last year in this language?
Solved! Go to Solution.
I'm going to go with
if Date.Year(DateTime.LocalNow()) = ( [InvPayment_Due_Year] ) or Date.Year(DateTime.LocalNow()) = ( [InvPayment_Due_Year]+1 ) then 1 else 0
since i've gone thru the pain of learning this today.
determines if an end date is in this year or next (for a gantt visual filter)
= Table.AddColumn(#"convert progress to percent", "ganttyearfilter", each if([Forecast End Date] is null) then "0" else if(Date.IsInCurrentYear([Forecast End Date])) then "1" else if(Date.IsInNextYear([Forecast End Date]))then "2" else "99")
Question: why define separate columns for this in Power Query when you can easily accomplish the same in DAX?
But if you have to, there are M functions to accomplish this...
Because I had this at the report level. I want it at the data source "edit query" level so I dont need to write a new formula for every report the data source references.
I've searched for half an hour on google and here and found nothing. The M documentation is not so good.
Are you trying to accomplish a year over year comparison?
No, Im creating a filter to limit data to this year and last year.
Oversimplifying, but you could simply have columns for year and amount and filter for Date.IsInPreviousYear or Date.IsInCurrentYear. Having amounts in different fields could make measure writing later on more complicated than it needs to be
I'm going to go with
if Date.Year(DateTime.LocalNow()) = ( [InvPayment_Due_Year] ) or Date.Year(DateTime.LocalNow()) = ( [InvPayment_Due_Year]+1 ) then 1 else 0
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
100 | |
80 | |
64 | |
58 |
User | Count |
---|---|
146 | |
110 | |
93 | |
84 | |
67 |