Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Anonymous
Not applicable

If function -> Else part doesn't work

Hi,

 

I have data from my divisions that I collect quarterly  that are based on our Fiscal Year (starting in April)

FYQuarterNumber of...Number of...Number of...Number of...Number of...Number of...

 

Since I want to do time intelligence (QoQ%), I have create new colum to get a date out of FY & Quarter : 2020 Q1->20200401 -> 2020-04-01.  

What I am trying to achieve here is to remove one year for every quarter except Q4.

 

Adjusted Date =
IF (
    'Report'[Quarter] = "Q4",
    'Report'[Date],
    DATEADD ( 'Report'[Date], -1YEAR )
)

 

Fiscal Year 2020

Expected Output

FYQuarterDateAdjusted Date
2020Q12020-04-012019-04-01
2020Q22020-07-012019-07-01
2020Q32020-10-102019-10-10
2020Q42020-01-012020-01-01

 

My output

FYQuarterDateAdjusted Date
2020Q12020-04-01 
2020Q22020-07-01 
2020Q32020-10-10 
2020Q42020-01-012020-01-01

 

Thank you,

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Matpel10 , Test as

Set date : date(Year([date])-1, month([date]),day([date]))

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Thank you! It does work. However, it is weird that it doesn't work with an IF statement. @amitchandak 

 

amitchandak
Super User
Super User

@Matpel10 , Test as

Set date : date(Year([date])-1, month([date]),day([date]))

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.