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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
imran_uridetech
Frequent Visitor

Dax CountRows of Records of New users for given period

Hi All,

I have a dax model, where I identify new users marked as "1" in a field.
The new user identification appears only one time to those records which consists new users first time in the model.
e.g. for a given period the data as follows:
User A - 0
User A - 0
User A - 0
User B - 1
User B - 0
User A - 0
User A - 0
User A - 0
User B - 0
User A - 0
User C - 1
User C - 0

In the above data "User A" does not qualify as a new user as he was an old user from previous period. But users "B" & "C" are new users in the given period.
I want to create a measure which calculates "countrows" of new users in the given period.
Expected results:
zero for User A
3 for User B
2 for User C

Any help is appreciated.

1 ACCEPTED SOLUTION
Mbuhary_AOud
New Member

Try This:

Measure = 
VAR NewUsersCALCULATETABLE(SELECTCOLUMNS(FactTable,"NewUser",[User_ID]),Filter(FactTable,FactTable[NewField]=1))
RETRUN CALCULATE(COUNTROWS(FactTable),Filter(FactTable,FactTable[User_ID] IN NewUsers))

You can use external filters to select dates / periods and the measure will generate the required results accordingly.

View solution in original post

2 REPLIES 2
Mbuhary_AOud
New Member

Try This:

Measure = 
VAR NewUsersCALCULATETABLE(SELECTCOLUMNS(FactTable,"NewUser",[User_ID]),Filter(FactTable,FactTable[NewField]=1))
RETRUN CALCULATE(COUNTROWS(FactTable),Filter(FactTable,FactTable[User_ID] IN NewUsers))

You can use external filters to select dates / periods and the measure will generate the required results accordingly.

Ashish_Mathur
Super User
Super User

Hi,

Write this measure

=if(sum(Data[Number])>0,countrows(Data),0)

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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