Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
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
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
86 | |
78 | |
54 | |
39 | |
35 |
User | Count |
---|---|
102 | |
84 | |
48 | |
48 | |
48 |