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
g1davies
Helper I
Helper I

Creating a graph which shows how many days in a week that a customer visits

HI,

 

I am trying to show how many days a customer visits per week.

 

I have all the visit data which has a line per visit (please note some customers visit more than once a day).

 

I would like to create a bar chart that shows how many customers have visited:

 

Once per week

Twice per week

Three times per week

Four times or more

 

and would also like this for each week of the year, to be able to show if we are increasing the amount of customer visits per week.

 

Can anyone help??

 

Thanks

 

Gavin

1 ACCEPTED SOLUTION

Hey,

 

then I would simply create an index column.

 

Open the query editor and edit your visit table: 

 

In addition I would first order the date column "Ascending"

Sort Column.png

 

If you find my posts helpful you may consider to mark one as a solution and may also want to kudo one of the posts

 

Hope this helps

 

And then add an index column

Add Index Column.png



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

5 REPLIES 5
TomMartens
Super User
Super User

Hey,

 

here you find a pbix file with a very simpliefied model.

The model just has two tables: visits and calendar

Count Customer Visits.png 

 

I created two calculated columns in the visit table, this is necessary, because otherwise it's not possible to "sclice" the data in a visual

WeekNo just pulls the WeekNo from the Calendar table into the Visit table, this column is hidden from the report view.

And I also create a calculated column "frequency"

frequency = 
SWITCH(
CALCULATE(
    COUNT('Visit'[Customer]),
    ALLEXCEPT(Visit,Visit[WeekNo],Visit[Customer])
),
1,"1 visit",
2,"2 visits",
3,"3 visits",
"4 and more")

This calculation creates a frequency, by counting how often a customer has shown during a week.

 

The column chart shows the frequency during the weeks and linechart show that in the 2nd week there have been 3 distinct customer (just using the distinct count aggregate function on the customer in the visual)

Some visuls.png 

 

Hope this gets you started



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Hi Tom,

 

That is really good thank you, I am nearly there. I have one issue which is i do not have an amount of visits coulum, I just have a line of data for each visit with customer details and date of visit, how do I create this coulmn?

 

Thanks

 

Gavin

Hey,

 

then I would simply create an index column.

 

Open the query editor and edit your visit table: 

 

In addition I would first order the date column "Ascending"

Sort Column.png

 

If you find my posts helpful you may consider to mark one as a solution and may also want to kudo one of the posts

 

Hope this helps

 

And then add an index column

Add Index Column.png



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Hi Tom,

 

Checking the data, I found another issue, some people are visiting more than once per day. for example someone who has visited 2 times for two days is counted as 4 or more visits but i need them to appear as 2 as they have come in for 2 days. can I do this?

 

Thanks

 

Gavin

Awesome work, thanks

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.