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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
ddpl
Solution Sage
Solution Sage

Want to create a table which include date wise unique count of users who are completely fresh

I have table which contains User_ID and Date Column from 1 st of Jan 2022 represent login activity on website

I Want to create a table which include date wise unique count of users who are completely fresh (never visited before)
Like on 2nd January there are 10 new user who are not visited in 1st of January or on 1st of March there are 7 new user who are not visited in last two month(Jan and Feb)

 

Please give me best and easy way to do it.

 

Thanks in advance

4 ACCEPTED SOLUTIONS
ddpl
Solution Sage
Solution Sage

@speedramps Thanks for your time

 

But we required to create a line chart as per daily fresh inflow of user.Please find attached snap wrt required line chart with automatic uopdate the same unique count day wise.

 

Table1:

User IDDate
A1/1/2022
B1/1/2022
C1/1/2022
D1/1/2022
B1/2/2022
D1/2/2022
E1/2/2022
D1/3/2022
F1/3/2022
G

1/3/2022

 

Output:

DateUnique Count of user
1/1/2022          4
1/2/2022          1
1/3/2022           Untitled.png2

 

 

 

View solution in original post

v-yangliu-msft
Community Support
Community Support

Hi  @ddpl ,

Here are the steps you can follow:

1. In Power query. Add Column – Index Column – From 1.

vyangliumsft_0-1651802819252.png

2. Create measure.

Flag =
var _1=CALCULATE(MAX('Table'[User ID]),FILTER(ALL('Table'),'Table'[Index]=MAX('Table'[Index])&&'Table'[Date]<=MAX('Table'[Date])))
var _2=CALCULATE(MAX('Table'[User ID]),FILTER(ALL('Table'),'Table'[Index]=MAX('Table'[Index])&&'Table'[Date]=MAX('Table'[Date])))
return
CALCULATE(DISTINCTCOUNT('Table'[User ID]), FILTER(ALL('Table'), _2 in SELECTCOLUMNS('Table',"id",_1)&&'Table'[Date]<=MAX('Table'[Date])))
Unique Count of user =
var _index1=MAXX(FILTER(ALL('Table'),'Table'[Date]=MAX('Table'[Date])),[Flag])
var _index2=MAXX(FILTER(ALL('Table'),'Table'[Date]=MAX('Table'[Date])-1),[Flag])
return
_index1 - _index2

2. Result:

vyangliumsft_1-1651802819253.png

 

Best Regards,

Liu Yang

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

@v-yangliu-msft 

 

Its worked, Thanks a lot for your time

View solution in original post

Hi Liu

 

Can I use below dax instead of yours?

 

Flag New = CALCULATE(DISTINCTCOUNT('Table'[User ID]), FILTER(ALL('Table'),'Table'[DDate]<=MAX('Table'[Date])))
 
Unique Count of USer  =
var _index1=MAXX(FILTER(ALL('Table'),'Table'[Date]=MAX('Table'[Date])),[Flag New])
var _index2=MAXX(FILTER(ALL('Table'),'Table'[Date]=MAX('Table'[Date])-1),[Flag New])
return
_index1 - _index2
 
This also give me same result.
 

View solution in original post

8 REPLIES 8
v-yangliu-msft
Community Support
Community Support

Hi  @ddpl ,

Here are the steps you can follow:

1. In Power query. Add Column – Index Column – From 1.

vyangliumsft_0-1651802819252.png

2. Create measure.

Flag =
var _1=CALCULATE(MAX('Table'[User ID]),FILTER(ALL('Table'),'Table'[Index]=MAX('Table'[Index])&&'Table'[Date]<=MAX('Table'[Date])))
var _2=CALCULATE(MAX('Table'[User ID]),FILTER(ALL('Table'),'Table'[Index]=MAX('Table'[Index])&&'Table'[Date]=MAX('Table'[Date])))
return
CALCULATE(DISTINCTCOUNT('Table'[User ID]), FILTER(ALL('Table'), _2 in SELECTCOLUMNS('Table',"id",_1)&&'Table'[Date]<=MAX('Table'[Date])))
Unique Count of user =
var _index1=MAXX(FILTER(ALL('Table'),'Table'[Date]=MAX('Table'[Date])),[Flag])
var _index2=MAXX(FILTER(ALL('Table'),'Table'[Date]=MAX('Table'[Date])-1),[Flag])
return
_index1 - _index2

2. Result:

vyangliumsft_1-1651802819253.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Hi Liu

 

Can I use below dax instead of yours?

 

Flag New = CALCULATE(DISTINCTCOUNT('Table'[User ID]), FILTER(ALL('Table'),'Table'[DDate]<=MAX('Table'[Date])))
 
Unique Count of USer  =
var _index1=MAXX(FILTER(ALL('Table'),'Table'[Date]=MAX('Table'[Date])),[Flag New])
var _index2=MAXX(FILTER(ALL('Table'),'Table'[Date]=MAX('Table'[Date])-1),[Flag New])
return
_index1 - _index2
 
This also give me same result.
 

@v-yangliu-msft 

 

Its worked, Thanks a lot for your time

ddpl
Solution Sage
Solution Sage

@speedramps Thanks for your time

 

But we required to create a line chart as per daily fresh inflow of user.Please find attached snap wrt required line chart with automatic uopdate the same unique count day wise.

 

Table1:

User IDDate
A1/1/2022
B1/1/2022
C1/1/2022
D1/1/2022
B1/2/2022
D1/2/2022
E1/2/2022
D1/3/2022
F1/3/2022
G

1/3/2022

 

Output:

DateUnique Count of user
1/1/2022          4
1/2/2022          1
1/3/2022           Untitled.png2

 

 

 

speedramps
Super User
Super User

Try this and please click the thumbs up for me helping you.
And click Accept As Solution if it fixes your problem 

create this measure
 
New Users =
VAR myset = VALUES(Facts[User ID] )
RETURN
"(" &

 

CONCATENATEX (
myset ,
Facts[User ID],
", " )

 

& ")"
 
then drag and drop Date and New Users to a table visual
selimovd
Super User
Super User

Hey @ddpl ,

 

can you provide an example file?

That would make it easier to provide a solution that works for you.

 

Best regards

Denis

I have data...

User IDDate
A01-01-22
B01-01-22
C01-01-22
D01-01-22
B01-02-22
D01-02-22
E01-02-22
D01-03-22
F01-03-22
G01-03-22

 

I want output as below...

Fresh UsersDate 
401-01-22(A,B,C,D)
101-02-22(E)
201-03-22(F,G)
speedramps
Super User
Super User

Consider this solution,

Please click the thumbs up for me helping you.
And click Accept As Solution if it fixes your problem 

 

Number of new customers =
/* Documentation
Get number of new customers as follows:-
Use addcolumns to get subset with (CustomerKey,Previous Rows)
Then filter the subset to just to include CustomerKeys with no previous rows.
Then count the number of Customers
*/

VAR mindate = MIN ( 'Calendar'[Date] )

VAR NewCustomers =
FILTER (
ADDCOLUMNS (
VALUES ( FactSales[CustomerKey] ),
"PreviousRows",
CALCULATE (COUNTROWS (FactSales ),
FILTER (ALL ( 'Calendar'[Date] ),'Calendar'[Date] < mindate))
),
[PreviousRows] = 0
)

RETURN
COUNTROWS(NewCustomers)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.