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 wish to add a calculated column in my PowerBI report, which calculates the hours saved based on the date provided and hourly savings up until todays date. The only caveat is that I only need the hours to be calculated for 2018.
We have a Sharepoint list, which has columns for "start date" and monthly savings (in hours). However we have projects which go back a few years, which I do not wish to include.
The DAX I have for the project run time is:
Project Run Time = IF('LEANSavings '[OccurenceValue] = "Re-Occurring Savings", (TODAY() - 'LEANSavings '[SavingsStartDate].[Date])/30, 1)
I wish to add something to state that if
LEANSavings '[SavingsStartDate].[Date]
is before 1/1/2018, then the date should be 1/1/2018
Solved! Go to Solution.
Project Run Time = VAR startdate = IF('LEANSavings '[SavingsStartDate].[Date] < DATE(2018,1,1),DATE(2018,1,1),'LEANSavings '[SavingsStartDate].[Date]) RETURN IF('LEANSavings '[OccurenceValue] = "Re-Occurring Savings", (TODAY() - startdate)/30, 1)
Project Run Time = VAR startdate = IF('LEANSavings '[SavingsStartDate].[Date] < DATE(2018,1,1),DATE(2018,1,1),'LEANSavings '[SavingsStartDate].[Date]) RETURN IF('LEANSavings '[OccurenceValue] = "Re-Occurring Savings", (TODAY() - startdate)/30, 1)
That is fantastic Greg, thank you.
I did start to do something very similar, buit keep forgetting whether to use 'Let' or Var'. Occassionally when I type in Var, PoiwerBI only gives me options like Var.P
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 |
---|---|
114 | |
99 | |
82 | |
70 | |
60 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |