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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
lorenz0210
Helper I
Helper I

How to do Dax Calculate Count with 2 date period

Hello @everyone, 

 

I am trying to do a win loss analysis with closing ratio. I would like to create a dax that will: 

 

1. Count the number of WINS with production date starting 9/1/2023

2. Count the number of losses with the timestamp closed of 9/1/2023. 

 

Currently I created a dax that only counts the win and loss but no dates/period. 

 

Here is my dax sample: 

** For WINS Count**

Closing Ratio Win Count =
    CALCULATE(COUNT('2024 Closing Ratio - ALL'[Win_Loss_Status]),
    '2024 Closing Ratio - ALL'[Win_Loss_Status]="Win")
 
** For LOSSES Count** 
Closing Ratio Loss Count =
    CALCULATE(COUNT('2024 Closing Ratio - ALL'[Win_Loss_Status]),
    '2024 Closing Ratio - ALL'[Win_Loss_Status]="Closed")
 
Hoping anyone can help. 
 
Thank you. 
 
 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @lorenz0210 ,

You can update the formula of your measures as below and check if they can return the expected result.

** For WINS Count**

Closing Ratio Win Count =
CALCULATE (
    COUNT ( '2024 Closing Ratio - ALL'[Win_Loss_Status] ),
    FILTER (
        '2024 Closing Ratio - ALL',
        '2024 Closing Ratio - ALL'[Win_Loss_Status] = "Win"
            && '2024 Closing Ratio - ALL'[production date] >= DATE ( 2023, 9, 1 )
    )
)

** For LOSSES Count** 

Closing Ratio Loss Count =
CALCULATE (
    COUNT ( '2024 Closing Ratio - ALL'[Win_Loss_Status] ),
    FILTER (
        '2024 Closing Ratio - ALL',
        '2024 Closing Ratio - ALL'[Win_Loss_Status] = "Closed"
            && '2024 Closing Ratio - ALL'[timestamp] = DATE ( 2023, 9, 1 )
    )
)

If the above one can't help you get the expected result, please provide some raw data in your table '2024 Closing Ratio - ALL' (exclude sensitive data) with Text format and your expected result with special examples and screenshots. You can refer the following link to share the required info:

How to provide sample data in the Power BI Forum

 

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @lorenz0210 ,

You can update the formula of your measures as below and check if they can return the expected result.

** For WINS Count**

Closing Ratio Win Count =
CALCULATE (
    COUNT ( '2024 Closing Ratio - ALL'[Win_Loss_Status] ),
    FILTER (
        '2024 Closing Ratio - ALL',
        '2024 Closing Ratio - ALL'[Win_Loss_Status] = "Win"
            && '2024 Closing Ratio - ALL'[production date] >= DATE ( 2023, 9, 1 )
    )
)

** For LOSSES Count** 

Closing Ratio Loss Count =
CALCULATE (
    COUNT ( '2024 Closing Ratio - ALL'[Win_Loss_Status] ),
    FILTER (
        '2024 Closing Ratio - ALL',
        '2024 Closing Ratio - ALL'[Win_Loss_Status] = "Closed"
            && '2024 Closing Ratio - ALL'[timestamp] = DATE ( 2023, 9, 1 )
    )
)

If the above one can't help you get the expected result, please provide some raw data in your table '2024 Closing Ratio - ALL' (exclude sensitive data) with Text format and your expected result with special examples and screenshots. You can refer the following link to share the required info:

How to provide sample data in the Power BI Forum

 

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

bhanu_gautam
Super User
Super User

@lorenz0210 , Try using below method

 

Closing Ratio Win Count =
CALCULATE (
COUNT('2024 Closing Ratio - ALL'[Win_Loss_Status]),
'2024 Closing Ratio - ALL'[Win_Loss_Status] = "Win",
'2024 Closing Ratio - ALL'[Production_Date] >= DATE(2023, 9, 1)
)

Closing Ratio Loss Count =
CALCULATE (
COUNT('2024 Closing Ratio - ALL'[Win_Loss_Status]),
'2024 Closing Ratio - ALL'[Win_Loss_Status] = "Loss",
'2024 Closing Ratio - ALL'[Closed_Timestamp] >= DATE(2023, 9, 1)
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.