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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Anonymous
Not applicable

Creating calculated column with if condition based on quarter difference

Hello All,

I have below table in my power bi file.

Customer name

Onboard date

Users added date

total users

ABC

01 January 2022

01 January 2022

20

ABC

01 January 2022

01 March 2022

30

BCD

01 March 2022

01 April 2022

25

BCD

01 March 2022

01 May 2022

60

PQR

01 May 2022

01 June 2022

45

PQR

01 May 2022

01 July 2022

50

 

Now, I need to create a new column to classify the whether the user added date is falling under the same quarter the customer on-boarded or previous quarter

The classification as below.

For Example, if the customer on-boarded on jan-22 and the user added on Mar-22, then I need to classify "User added from customer with on-board date in same quarter”

If user added on May-22 and the customer on-boarded on Jan-22, then I need to classify “user added from customer with on-board date in previous quarter”

If user added on July-22 and the customer on-boarded before previous quarter between Oct-21 to Dec-21 or Jan-22 to Mar-22, Then I need to classify “user added from customer with on-board date before last 2 quarters”

If user added on July-22 and the customer on-boarded before oct-21, then I need to classify “user added from customer with on-board date greater than 4 quarters”

New column which I will be adding should be like highlighted below

Customer name

Onboard date

Users added date

total users

Classification

ABC

01 January 2022

01 January 2022

20

User added from customer with on-board date in same quarter

ABC

01 February 2022

01 April 2022

30

user added from customer with on-board date in previous quarter

BCD

01 March 2022

01 April 2022

25

user added from customer with on-board date in previous quarter

BCD

01 December 2021

01 May 2022

60

user added from customer with on-board date before last 2 quarters

PQR

01 May 2021

01 June 2022

45

user added from customer with on-board date greater than 4 quarters

PQR

01 June 2022

01 July 2022

50

user added from customer with on-board date in previous quarter

 

 

 

1 ACCEPTED SOLUTION
lukiz84
Memorable Member
Memorable Member

Add a column

 

DiffInQuarters := DATEDIFF([Onboard date], [Users added date], QUARTER)

 

and move on from there. The rest should be easy.

 

br

View solution in original post

1 REPLY 1
lukiz84
Memorable Member
Memorable Member

Add a column

 

DiffInQuarters := DATEDIFF([Onboard date], [Users added date], QUARTER)

 

and move on from there. The rest should be easy.

 

br

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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