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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
seppel123
Frequent Visitor

How to set up a calculated column to write back a date from another row and count during these dates

Hi all,

 

i am working on a problem in Power BI and could not solve it.

I have a table with Dates, Names of Employees and Status of these employees. Also, there is a Column with the previous Status of that employee and the NextStatus. My raw data and the 2 columns i wanted looks like this:

 

DateNameStatusPrivStatusNextStatusK startK endK end (wanted)Amount K during K start and end (wanted)
29. Jan 24Employee1AAA    
01. Feb 24Employee1AAA    
02. Feb 24Employee1AAK    
05. Feb 24Employee1KAK05.02.2024 17.02.20246
06. Feb 24Employee1KKK    
09. Feb 24Employee1KKK    
10. Feb 24Employee1KKK    
13. Feb 24Employee1KKK    
14. Feb 24Employee1KKA    
17. Feb 24Employee1AKA 17.02.2024  
18. Feb 24Employee1AAA    
21. Feb 24Employee1AAA    
28. Mrz 24Employee1AAA    
29. Mrz 24Employee1AAA    
01. Apr 24Employee1AAA    
02. Apr 24Employee1AAA    
05. Apr 24Employee1AAA    
06. Apr 24Employee1AAK    
09. Apr 24Employee1KAK09.04.2024 11.05.20246
10. Apr 24Employee1KKK    
03. Mai 24Employee1KKK    
04. Mai 24Employee1KKK    
07. Mai 24Employee1KKK    
08. Mai 24Employee1KKA    
11. Mai 24Employee1AKA 11.05.2024  
12. Mai 24Employee1AAA    
15. Mai 24Employee1AAU    
16. Mai 24Employee1UAU    
09. Jan 24Employee2AAK    
10. Jan 24Employee2KAK10.01.2024 17.01.20243
13. Jan 24Employee2KKK    
14. Jan 24Employee2KKA    
17. Jan 24Employee2AKA 17.01.2024  
18. Jan 24Employee2AAU    
26. Jan 24Employee2UAA    
29. Jan 24Employee2AUA    
30. Jan 24Employee2AAK    
02. Feb 24Employee2KAK02.02.2024 18.02.20244
03. Feb 24Employee2KKK    
14. Feb 24Employee2KKK    
15. Feb 24Employee2KKA    
18. Feb 24Employee2AKA 18.02.2024  
19. Feb 24Employee2AAK    

 

I managed via calculated column to generate the column "K start": 

 

K Start= 
VAR Date_K_Start = 
    IF(
        AND([Status] = "K", [PrivStatus] <> "K"),
        [Date],
        BLANK()
    )
RETURN
    FORMAT(Date_K_Start, "DD.MM.YYYY")

 

 

The same i used to get the column K end:

 

K end = 
VAR Date_K_end= 
    IF(
        AND([Status] <> "K", [PrivStatus] = "K"),
        [Date],
        BLANK()
    )
RETURN
    FORMAT(Date_K_end, "DD.MM.YYYY")

 

 

But of course K end goes in the wrong row in the Column. My question is how to i get it in the right row (together with the K start). Since there are many Employees in this list, it needs to filter correctly for the same name.

 

Furthermore: I would like to count how many times "K" in [Status] appears during K start and K end. 

 

Thanks in advance! 

seppel123

1 ACCEPTED SOLUTION
danextian
Super User
Super User

Hi @seppel123 

Please see the attached pbix.

danextian_0-1732258708446.png

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

1 REPLY 1
danextian
Super User
Super User

Hi @seppel123 

Please see the attached pbix.

danextian_0-1732258708446.png

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors