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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
AAOLIVARESR
Frequent Visitor

Help with generating a summary table

Hello,

I want to create a summary table in Power BI that tells me the amount of tickets for a week for example:

Fromto
2024-20-052024-26-05
Tickets inTickets out
810

From the following example dataset:

TicketDate inDate out
A-112-04-202420-05-2024
A-219-04-202420-05-2024
A-321-05-202420-05-2024
A-421-05-202421-05-2024
A-521-05-202422-05-2024
A-621-05-202423-05-2024
A-725-05-202424-05-2024
A-825-05-202425-05-2024
A-925-05-202425-05-2024
A-1025-05-202425-05-2024

The problem I have is that I can't find a way to assign the number of tickets in the same table or chart using different dates (see example) because tickets that are closed during the week were not necessarily created that same week.

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hi,@AAOLIVARESR. Hello,@ryan_mayu ,thanks for your concern about this issue.And I would like to share some additional solutions below.
I am glad to help you.

According to your description, you want to count the number of tickets in a selected time period

You could refer to my test result below, hope it can help you.
Here is my test data:

vjtianmsft_0-1716863262170.png

vjtianmsft_1-1716863270752.png

I created two measures to calculate the number of Tickets whose DateIn and DateOut are within the range selected by the slicer.

Here is the Dax code

M_ticketIn = 
VAR minDate=MIN('Dates'[Date])
VAR maxDate=MAX('Dates'[Date])
RETURN
CALCULATE(
    COUNT(SaleTicket[Ticket]),FILTER(ALL(SaleTicket),'SaleTicket'[Date in]>=minDate&&'SaleTicket'[Date in]<=maxDate))
M_ticketOut = 
VAR minDate=MIN('Dates'[Date])
VAR maxDate=MAX('Dates'[Date])
RETURN
CALCULATE(
    COUNT('SaleTicket'[Ticket]),FILTER(ALL('SaleTicket'),'SaleTicket'[Date out]>=minDate&&'SaleTicket'[Date out]<=maxDate))

I've created a measrue M_result that counts the number of Tickets that match both DateIn and DateOut for the selected time period.

i.e. the number of tickects that start and end in the selected time period.

M_result = 
IF('SaleTicket'[M_ticketIn]<='SaleTicket'[M_ticketOut],'SaleTicket'[M_ticketIn],'SaleTicket'[M_ticketOut])

You can also try to use the WeekNum function to get the number of weeks for each date to calculate (this avoids having to set the time period manually).
Here is the test result:

vjtianmsft_2-1716863402445.png

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.

Best Regards,

Carson Jian,

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

Ashish_Mathur
Super User
Super User

Hi,

I cannot understand your expected result of 8 and 10?  Explain that in detail.


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

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

I cannot understand your expected result of 8 and 10?  Explain that in detail.


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

Hi,@AAOLIVARESR. Hello,@ryan_mayu ,thanks for your concern about this issue.And I would like to share some additional solutions below.
I am glad to help you.

According to your description, you want to count the number of tickets in a selected time period

You could refer to my test result below, hope it can help you.
Here is my test data:

vjtianmsft_0-1716863262170.png

vjtianmsft_1-1716863270752.png

I created two measures to calculate the number of Tickets whose DateIn and DateOut are within the range selected by the slicer.

Here is the Dax code

M_ticketIn = 
VAR minDate=MIN('Dates'[Date])
VAR maxDate=MAX('Dates'[Date])
RETURN
CALCULATE(
    COUNT(SaleTicket[Ticket]),FILTER(ALL(SaleTicket),'SaleTicket'[Date in]>=minDate&&'SaleTicket'[Date in]<=maxDate))
M_ticketOut = 
VAR minDate=MIN('Dates'[Date])
VAR maxDate=MAX('Dates'[Date])
RETURN
CALCULATE(
    COUNT('SaleTicket'[Ticket]),FILTER(ALL('SaleTicket'),'SaleTicket'[Date out]>=minDate&&'SaleTicket'[Date out]<=maxDate))

I've created a measrue M_result that counts the number of Tickets that match both DateIn and DateOut for the selected time period.

i.e. the number of tickects that start and end in the selected time period.

M_result = 
IF('SaleTicket'[M_ticketIn]<='SaleTicket'[M_ticketOut],'SaleTicket'[M_ticketIn],'SaleTicket'[M_ticketOut])

You can also try to use the WeekNum function to get the number of weeks for each date to calculate (this avoids having to set the time period manually).
Here is the test result:

vjtianmsft_2-1716863402445.png

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.

Best Regards,

Carson Jian,

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

ryan_mayu
Super User
Super User

why the number for tickets in is 8?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors