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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Jack_D
Frequent Visitor

Calculated column question

HI All 
I have a challenge task that required some help. 

Jack_D_0-1724042983577.png

My dataset is located on the left, and my desired output logic involves marking only the first action for each product. By doing so, I can calculate the number of first actions per product.

Thank you in advance for your kind assistance. 😊

Jack

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi ValtteriN ,thanks for the quick reply, I'll add more.

Hi @Jack_D ,

The Table data is shown below:

vzhouwenmsft_0-1724122467920.png

Please follow these steps:

1.Creating an index column in Power Query

vzhouwenmsft_1-1724122715001.png

vzhouwenmsft_2-1724122827498.png

 

Table.AddIndexColumn([Column],"Index",1)

 

vzhouwenmsft_3-1724122863623.png

vzhouwenmsft_4-1724122903910.png

vzhouwenmsft_5-1724122938417.png

2.Use the following DAX expression to create a column(The data type of the 'Index' column is number)

Column = 
VAR _Product_type = [Product type1]
VAR _1st = MAXX(FILTER('Table',[Product type1] = _Product_type && [Index] = 1),[Actions])
VAR _2nd = MINX(FILTER('Table',[Product type1] = _Product_type && [Actions] <> _1st ) ,[Index])
RETURN IF([Index] >= _2nd,FALSE(),TRUE())

vzhouwenmsft_0-1724132707591.png

3.Use the following DAX expression to create a measure

Measure = 
COUNTROWS(FILTER('Table',[Column]  = TRUE()))

4.Final output

vzhouwenmsft_1-1724132747133.png

Best Regards,
Wenbin Zhou

 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi ValtteriN ,thanks for the quick reply, I'll add more.

Hi @Jack_D ,

The Table data is shown below:

vzhouwenmsft_0-1724122467920.png

Please follow these steps:

1.Creating an index column in Power Query

vzhouwenmsft_1-1724122715001.png

vzhouwenmsft_2-1724122827498.png

 

Table.AddIndexColumn([Column],"Index",1)

 

vzhouwenmsft_3-1724122863623.png

vzhouwenmsft_4-1724122903910.png

vzhouwenmsft_5-1724122938417.png

2.Use the following DAX expression to create a column(The data type of the 'Index' column is number)

Column = 
VAR _Product_type = [Product type1]
VAR _1st = MAXX(FILTER('Table',[Product type1] = _Product_type && [Index] = 1),[Actions])
VAR _2nd = MINX(FILTER('Table',[Product type1] = _Product_type && [Actions] <> _1st ) ,[Index])
RETURN IF([Index] >= _2nd,FALSE(),TRUE())

vzhouwenmsft_0-1724132707591.png

3.Use the following DAX expression to create a measure

Measure = 
COUNTROWS(FILTER('Table',[Column]  = TRUE()))

4.Final output

vzhouwenmsft_1-1724132747133.png

Best Regards,
Wenbin Zhou

 

ValtteriN
Super User
Super User

Hi,

This should give you the desired result:

First =
IF(
RANKX(
    FILTER(
        ALL('Table (40)'),
        'Table (40)'[Product] = EARLIER('Table (40)'[Product])
    ),
    [Date],
    ,
    ASC
)=1,1,BLANK())

End result:
ValtteriN_0-1724044280864.png

 

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/







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

Proud to be a Super User!




Thanks Valtterin
I am trying to calculated Sum of All first actions so the out put will be 

Jack_D_0-1724044692810.png

 


 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

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.