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, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
Kumar11109
Helper IV
Helper IV

Tagging Videos For each session

I have a data set in which I need to tag resources used in a session, starting from 1. I am attaching an image for a sample of my data set. Please help me... Screenshot (11).png

 

 

2 ACCEPTED SOLUTIONS

@Kumar11109,

 

Check if RANKX Function works.

Rank =
RANKX (
    FILTER ( Table1, Table1[Session ID] = EARLIER ( Table1[Session ID] ) ),
    Table1[Start Time],
    ,
    ASC,
    SKIP
)
Community Support Team _ Sam Zha
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

14 REPLIES 14
v-chuncz-msft
Community Support
Community Support

@Kumar11109,

 

You may use the following DAX to add a calculated column.

Flag =
IF (
    MAXX (
        TOPN (
            1,
            FILTER ( Table1, Table1[Session ID] = EARLIER ( Table1[Session ID] ) ),
            Table1[Start Time], ASC
        ),
        Table1[Resource]
    )
        = 1,
    1,
    0
)
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

There is one slight error, that my session id's are in alpha numeric and so the format its format is text. And when I am using your suggested formula the following error is shown: 

 

DAX comparison operations do not support comparing values of type Text with values of type Integer. Consider using the VALUE or FORMAT function to convert one of the values.

 

I tried formatting it using format and value function but to no avail.  

 

 

@Kumar11109,

 

Simply change it to VALUE ( Table1[Resource] ) or = "1".

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Sorry, but I did not understand. Could you explain it again. 

And my session id's are in the alpha numeric format, not my resources ids. 

@Kumar11109,

 

The data type of session id doesn't matter in formula above. Share the .pbix file if convenient.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Can you rewrite the formula, because did run successfully but it's resulting in only 0? I am attaching an image. 

Screenshot (12).png

@Kumar11109,

 

It works for your original sample data. You may need to check the actual data and change it accordingly. Better to learn more DAX basics before going ahead.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

The formula didn't work on my sample data set also.   Screenshot (13).png

 

 

@Kumar11109,

 

Please show us expected result based on your sample data.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-chuncz-msft

 

Some thing like this: 

Screenshot (14).png

 

 

 

Aren't there any commands like "Tag" found in stata for power bi. 

 

 

 

@Kumar11109,

 

Check if RANKX Function works.

Rank =
RANKX (
    FILTER ( Table1, Table1[Session ID] = EARLIER ( Table1[Session ID] ) ),
    Table1[Start Time],
    ,
    ASC,
    SKIP
)
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-chuncz-msft

RANKX worked, thanks. 

And my session id's are in the alpha numeric format, not my resources ids. 

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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