Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
I'm trying to calculate a conversion ratio, using two date columns, across a specific time period.
Deals Data Table (Columns):
created_at (DATE/TIME, NOT NULL)
closed_date (DATE/TIME, NULL)
deal_status_id (STRING, NOT NULL)
employee_id (STRING, NOT NULL)
I've created a DateKey table and setup two relationships with the cross filter set to single for both.
DateKey[Date] (1) > Deals[created_at] (many) (active)
DateKey[Date] (1) > Deals[closed_date] (many)
The measures i've created to perform the calculation:
Created Deals = CALCULATE (COUNTROWS(deals), USERELATIONSHIP(deals[created_at], DateKey[Date] ) )Won Deals = CALCULATE (countrows(deals), deals[deal_stage_id]=3000149092, USERELATIONSHIP ( deals[closed_date], DateKey[Date]) )
Close Ratio = ([Won Deals] / [Created Deals])
The issue i'm facing relates to calculating the data for a specific time period.
I've also tried to write time-specific DAX, but I get an error saying there are duplicate date values (which i don't quite understand):
Won_YTD = CALCULATE(COUNTROWS(deals), USERELATIONSHIP( deals[closed_date], DateKey[Date]), deals[deal_stage_id]=3000149092, DATESYTD(deals[closed_date]))
The above works properly... but...
Won_YTD = CALCULATE(COUNTROWS(deals), USERELATIONSHIP( deals[created_at], DateKey[Date]), DATESYTD(deals[created_at]))
Gives me an error about duplicate dates - Suggestions?
Hi @pe2950 ,
When you do the same with the DateKey[Date] slicer, please try to change the relationship between two tables to many>1.
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.
Best Regards,
Community Support Team _ xiaosun
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.