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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Andreas_Wacker
Frequent Visitor

Creating bar chart total visits with dynamic distinct count

Hello all,


a task that seems simple at first sight gets more complicated with every hour I spend trying, reading and thinking about it. If there is already a post about this, I didn't notice it because I guess I don't have the right words to describe it.


I have a chart with Customer_ID and Date(YYYY.MM.DD):

 

Customer_IDDate (YYYY.MM.DD)
12021.01.01
22021.01.02
32021.01.03
12021.01.04
12021.01.05
22021.01.06
42021.01.07
12021.01.08

 

At the end I want to create a chart from these data by
Axis (X) = Number of visits in period X (1 visit/ 2 v. / 3 v. / etc.)
Values = Number of unique customers in period X
Period X = dynmaically selected

 

Two bar chart examples:
Period 2021.01.01 to 01.08

Andreas_Wacker_0-1628516463126.png

Period 2021.01.03 to 01.08

Andreas_Wacker_1-1628516524147.png

 

Best

Andreas

 

 

 

 

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Picture1.png

 

Customers Count : =
VAR _currentvisitcount =
MAX ( 'Visit Count'[Visit Count] )
VAR _customersvisitcount =
FILTER (
ADDCOLUMNS (
SUMMARIZE ( Data, Customers[Customer_ID] ),
"@visitcount", CALCULATE ( COUNTROWS ( Data ) )
),
[@visitcount] = _currentvisitcount
)
RETURN
COUNTROWS ( _customersvisitcount )

 

 

Link to the sample pbix file 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

4 REPLIES 4
Andreas_Wacker
Frequent Visitor

Hello Jihwan_Kim,

 

it works. Thank you for your help.

 

Best,

Andreas

Andreas_Wacker
Frequent Visitor

Thank you JiHwan Kim for your quick reply. 

 

To understand it correctly, I have to create a new table with the unique ID's before I can start with the visualization. There is no other solution?

Hi,

Thank you for your feedback.

I created the dimension table for CustomerID because

- I do not know how your actual data model looks like. 

- in order to make data model a bit more easy to understand.

 

No need to create this dimension table.

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
Jihwan_Kim
Super User
Super User

Picture1.png

 

Customers Count : =
VAR _currentvisitcount =
MAX ( 'Visit Count'[Visit Count] )
VAR _customersvisitcount =
FILTER (
ADDCOLUMNS (
SUMMARIZE ( Data, Customers[Customer_ID] ),
"@visitcount", CALCULATE ( COUNTROWS ( Data ) )
),
[@visitcount] = _currentvisitcount
)
RETURN
COUNTROWS ( _customersvisitcount )

 

 

Link to the sample pbix file 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.