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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Syndicate_Admin
Administrator
Administrator

Get the Conditional Charge Change Period

Hello everyone

I have the following table that has 4 columns called: Period, ID, Job Title, and Start Date. The table can have multiple IDs, and each ID can have multiple charges. I need a new column without using the offset function, which shows me the Period in which I change the Charge for each ID, this new column called "Change Period", does NOT have to consider the first charge for each new Start Date as a change of charge. The idea is that the new column is shown below.

ArimaKousei_0-1710339396978.png

https://docs.google.com/spreadsheets/t/1M0V3SFS4DWJWJT68D7Ko_Directwu/Edit?USB=Drive_Link&White=1099...

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Syndicate_Admin 

 

First, you can create a new index column in the Power Query interface.

vjialongymsft_0-1710397798675.png

 

Then you can use the following dax to get the result you want.

Change Period = 
VAR CurrentRowID = 'Table'[ID]
VAR PreviousRowID = LOOKUPVALUE('Table'[ID],'Table'[Index],'Table'[Index]-1)
VAR CurrentRowJobTitle = 'Table'[Job Title]
VAR PreviousRowJobTitle = 
    LOOKUPVALUE('Table'[Job Title],'Table'[Index],'Table'[Index]-1)
RETURN
IF(
    CurrentRowID <> PreviousRowID,
    BLANK(),
    IF(CurrentRowJobTitle = PreviousRowJobTitle,BLANK(),'Table'[Period])
)

vjialongymsft_1-1710398067160.png

 

 

 

 

 

Best Regards,

Jayleny

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @Syndicate_Admin 

 

First, you can create a new index column in the Power Query interface.

vjialongymsft_0-1710397798675.png

 

Then you can use the following dax to get the result you want.

Change Period = 
VAR CurrentRowID = 'Table'[ID]
VAR PreviousRowID = LOOKUPVALUE('Table'[ID],'Table'[Index],'Table'[Index]-1)
VAR CurrentRowJobTitle = 'Table'[Job Title]
VAR PreviousRowJobTitle = 
    LOOKUPVALUE('Table'[Job Title],'Table'[Index],'Table'[Index]-1)
RETURN
IF(
    CurrentRowID <> PreviousRowID,
    BLANK(),
    IF(CurrentRowJobTitle = PreviousRowJobTitle,BLANK(),'Table'[Period])
)

vjialongymsft_1-1710398067160.png

 

 

 

 

 

Best Regards,

Jayleny

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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