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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Calculeted column to mark specific entries

Hi there, 

I am new with Power BI and DAX and this is my first post as hope you can help with this issue.

I have a history table (bi_avkhis) with different IDs (AVKID)and statuses (AKVSTATID) (see the table below). 

After AVKSTATID = 100 or 110 or 120 or 130 shouldn't be registered entries anymore so I need to sort out these entries if they are registered.

I want to create a column to mark with 1 the entries after status ID = 100 / 110 / 120 / 130 by AVKID.

Muster Tabelle.PNG

Can you please help on this? Thank you in advance.

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your datamodel looks like, but I tried to create a sample pbix file like below.

Please check the below picture and that attached pbix file.

I hope the below can provide some ideas on how to create a solution for your datamodel.

 

Jihwan_Kim_0-1663833468958.png

 

 

Flag CC =
VAR _target = { 100, 11, 120, 130 }
VAR _indexnumberhitstarget =
    MAXX (
        FILTER (
            BI_AVKHIS,
            BI_AVKHIS[AVKSTATID]
                IN _target
                    && BI_AVKHIS[AVKID] = EARLIER ( BI_AVKHIS[AVKID] )
        ),
        BI_AVKHIS[Index]
    )
VAR _indexnumberlistaftertarget =
    SUMMARIZE (
        FILTER (
            BI_AVKHIS,
            BI_AVKHIS[AVKID] = EARLIER ( BI_AVKHIS[AVKID] )
                && BI_AVKHIS[Index] > _indexnumberhitstarget
        ),
        BI_AVKHIS[Index]
    )
RETURN
    IF ( BI_AVKHIS[Index] IN _indexnumberlistaftertarget, 1 )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

@Jihwan_Kim Great! It works, thank you! 

Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your datamodel looks like, but I tried to create a sample pbix file like below.

Please check the below picture and that attached pbix file.

I hope the below can provide some ideas on how to create a solution for your datamodel.

 

Jihwan_Kim_0-1663833468958.png

 

 

Flag CC =
VAR _target = { 100, 11, 120, 130 }
VAR _indexnumberhitstarget =
    MAXX (
        FILTER (
            BI_AVKHIS,
            BI_AVKHIS[AVKSTATID]
                IN _target
                    && BI_AVKHIS[AVKID] = EARLIER ( BI_AVKHIS[AVKID] )
        ),
        BI_AVKHIS[Index]
    )
VAR _indexnumberlistaftertarget =
    SUMMARIZE (
        FILTER (
            BI_AVKHIS,
            BI_AVKHIS[AVKID] = EARLIER ( BI_AVKHIS[AVKID] )
                && BI_AVKHIS[Index] > _indexnumberhitstarget
        ),
        BI_AVKHIS[Index]
    )
RETURN
    IF ( BI_AVKHIS[Index] IN _indexnumberlistaftertarget, 1 )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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