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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Anonymous
Not applicable

DAX Function Calculation

Hello all,

 

I hope you are doing well.

I have this kind of Data below :

activityidActivityCreatatWeekNbr(ActivityCreat)user idUserCreatAtWeekNbr(UserCreat)
id104/01/20211id108/01/20211
id205/01/20211id201/01/202153
id310/01/20211id108/01/20211
id411/01/20212id108/01/20211
id512/01/20212id321/01/20213
id618/01/20213id108/01/20211
id719/01/20213id413/01/20212
id820/01/20213id108/01/20211
id921/01/20213id321/01/20213
id1022/01/20213id514/01/20212
id1123/01/20213id201/01/202153
id1224/01/20213id514/01/20212
id1325/01/20213id413/01/20212

 

And I want add a new column that calculate  the number of activities maked by new user during the week of creation :

 

activityidActivityCreatatWeekNbr(ActivityCreat)user idUserCreatAtWeekNbr(UserCreat)Nbr Activities maked by new user during the week of creation
id104/01/20211id108/01/202112 activities (id1 and id3)
id205/01/20211id201/01/2021530
id310/01/20211id108/01/202112 activities (id1 and id3)
id411/01/20212id108/01/202112 activities (id1 and id3)
id512/01/20212id321/01/202131 activity (id9)
id618/01/20213id108/01/202112 activities (id1 and id3)
id719/01/20213id413/01/202120 activity (during the week UserCreat)
id820/01/20213id108/01/202112 activities (id1 and id3)
id921/01/20213id321/01/202131 activity (id9)
id1022/01/20213id514/01/202120
id1123/01/20213id201/01/2021530
id1224/01/20213id514/01/202120
id1325/01/20213id413/01/202120 activity (during the week UserCreat)

 

Thank you for your help.

 

Best,

1 ACCEPTED SOLUTION
DataInsights
Super User
Super User

@Anonymous,

 

Try this calculated column:

 

Nbr Activities Made = 
VAR vUser = Table1[user id]
VAR vTable =
    FILTER (
        Table1,
        Table1[user id] = vUser
            && YEAR ( Table1[UserCreatAt] ) = YEAR ( Table1[ActivityCreatat] )
            && Table1[WeekNbr(UserCreat)] = Table1[WeekNbr(ActivityCreat)]
    )
VAR vResult =
    COUNTROWS ( vTable )
RETURN
    vResult

 

Result (m/d/yy format):

 

DataInsights_0-1615917480772.png

 





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

Proud to be a Super User!




View solution in original post

1 REPLY 1
DataInsights
Super User
Super User

@Anonymous,

 

Try this calculated column:

 

Nbr Activities Made = 
VAR vUser = Table1[user id]
VAR vTable =
    FILTER (
        Table1,
        Table1[user id] = vUser
            && YEAR ( Table1[UserCreatAt] ) = YEAR ( Table1[ActivityCreatat] )
            && Table1[WeekNbr(UserCreat)] = Table1[WeekNbr(ActivityCreat)]
    )
VAR vResult =
    COUNTROWS ( vTable )
RETURN
    vResult

 

Result (m/d/yy format):

 

DataInsights_0-1615917480772.png

 





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

Proud to be a Super User!




Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.