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.
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.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
94 | |
82 | |
66 | |
58 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |