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
Anonymous
Not applicable

Number of Sessions per Unique CP ID per day

Hi, 

('Fact Table'[CP ID]) - This column contains Chargepoint ID number 

('Fact Table'[Start Date]) - Start Date over 2 years data. 

 

I must calculate the Average number of Sessions per Unique CP ID number per day.

How many times the 'Unique' Chargepoint ID was used per day. 

 

CP ID Start
52562 29/10/2020
35360 03/06/2020
33210 24/04/2020
22300 29/08/2020
23410 17/07/2020
10181 23/10/2020

 

I do appreciate assistance on this. 

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

[@val] is the column added by ADDCOLUMNS, which in this case hold the total number of entries for that CP ID for that day. this is what is then averaged by the AVERAGEX function.

When I create columns on temporary tables for use in functions like this I usually prefix the column with an @ to make sure there is no possibility of it clashing with an actual column or measure.

View solution in original post

3 REPLIES 3
johnt75
Super User
Super User

[@val] is the column added by ADDCOLUMNS, which in this case hold the total number of entries for that CP ID for that day. this is what is then averaged by the AVERAGEX function.

When I create columns on temporary tables for use in functions like this I usually prefix the column with an @ to make sure there is no possibility of it clashing with an actual column or measure.

johnt75
Super User
Super User

Avg sessions per day =
var summaryTable = ADDCOLUMNS( SUMMARIZE( 'Fact Table', 'Fact Table'[Start date], 'Fact Table'[CP ID]),
   "@val", CALCULATE(COUNTROWS('Fact Table'))
)
return AVERAGEX( summaryTable, [@val])
Anonymous
Not applicable

Hi. Thank you, but what is @VAL? 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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