Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.
Hello guys,
I'm new to Power BI, and trying to learn how to write DAX and other calculated columns.
I have date colum only with 3 years data, and the financial year starts from July to June.
Condition is:
1) IF Date <= 01/07/2021 AND Date >= 30/06/2022 THEN "Current FY"
ELSE Date >=30/06/2021 THEN "Previous FY"
END
Need to calcualte current Financial year dynamically without hardcoding the values in the calculation.
Expected out of the calculated column should be below (Period) as an example.
Date | Period | |
1/01/2019 | Previous FY | |
1/02/2019 | Previous FY | |
1/03/2019 | Previous FY | |
1/04/2019 | Previous FY | |
1/05/2019 | Previous FY | |
1/06/2019 | Previous FY | |
1/07/2019 | Previous FY | |
1/08/2019 | Previous FY | |
1/09/2019 | Previous FY | |
1/10/2019 | Previous FY | |
1/11/2019 | Previous FY | |
1/12/2019 | Previous FY | |
1/01/2020 | Previous FY | |
1/02/2020 | Previous FY | |
1/03/2020 | Previous FY | |
1/04/2020 | Previous FY | |
1/05/2020 | Previous FY | |
1/06/2020 | Previous FY | |
1/07/2020 | Previous FY | |
1/08/2020 | Previous FY | |
1/09/2020 | Previous FY | |
1/10/2020 | Previous FY | |
1/11/2020 | Previous FY | |
1/12/2020 | Previous FY | |
1/01/2021 | Previous FY | |
1/02/2021 | Previous FY | |
1/03/2021 | Previous FY | |
1/04/2021 | Previous FY | |
1/05/2021 | Previous FY | |
1/06/2021 | Previous FY | |
1/07/2021 | Current FY | |
1/08/2021 | Current FY | |
1/09/2021 | Current FY | |
1/10/2021 | Current FY | |
1/11/2021 | Current FY | |
1/12/2021 | Current FY |
Please let me know how to achieve it.
Thanks in advance
Dee
Solved! Go to Solution.
@Deeintu , Try a new column in DAX like
new column =
var _month = month(today() )
var _year = year(today())
var _st = date(if(_month <=6, _year -1, _year),7,1)
var _end = date(if(_month <=6, _year , _year)+1,6,30)
return
if([date] >= _st && [Date] <=_end , "Current FY", "Previous FY")
@Deeintu , Try a new column in DAX like
new column =
var _month = month(today() )
var _year = year(today())
var _st = date(if(_month <=6, _year -1, _year),7,1)
var _end = date(if(_month <=6, _year , _year)+1,6,30)
return
if([date] >= _st && [Date] <=_end , "Current FY", "Previous FY")
Hi Amit,
Thank you very much!
Now I understood how to declare variables and include them in the calculation.
Regards
Dee
Check out the November 2023 Power BI update to learn about new features.
Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.