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
power_roboter
Frequent Visitor

Calculate in selectcolumns on all rows of a user

Hi dax experts,

 

I have a table with user log data and want to calculate the numberOfDays for the filtered users inside a selectcolumns. The problem is, that calculate(DISTINCTCOUNT('∑ Tracking Data'[Date_Key]) is always 1 for every user. It seems that calculate always refers to only one row of a user. But it must refer to all rows of a user. How can I implement this?

 

EVALUATE

DISTINCT (
SELECTCOLUMNS (
FILTER (
'∑ Tracking Data',
'∑ Tracking Data'[Application] = "product_a"
&& '∑ Tracking Data'[Userrole] = "customer"
),
"userID", '∑ Tracking Data'[userId],
"numberOfDays", calculate(DISTINCTCOUNT('∑ Tracking Data'[Date_Key]))
))

 

 

Unbenannt.PNG

 

 

 

1 ACCEPTED SOLUTION

maybe try ALLEXCEPT ( '∑ Tracking Data', '∑ Tracking Data'[Userrole] )

View solution in original post

4 REPLIES 4
harshnathani
Community Champion
Community Champion

Hi @power_roboter ,

 

Try ALL()

 

DISTINCT (
    SELECTCOLUMNS (
        FILTER (
            '∑ Tracking Data',
            '∑ Tracking Data'[Application] = "product_a"
                && '∑ Tracking Data'[Userrole] = "customer"
        ),
        "userID", '∑ Tracking Data'[userId],
        "numberOfDays", CALCULATE (
            DISTINCTCOUNT ( '∑ Tracking Data'[Date_Key] ),
            ALL ( '∑ Tracking Data' )
        )
    )
)

 

Regards,

Harsh Nathani

Appreciate with a Kudos!! (Click the Thumbs Up Button)

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

 

This is not working. The calculation then refers to all user data, but not to the data of a (one) user.

 

Unbenannt_2.PNG

maybe try ALLEXCEPT ( '∑ Tracking Data', '∑ Tracking Data'[Userrole] )

Works perfect! Thanks!

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.