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.
Hi all,
I have read several related topics, but have not found the answer (apparently).
I want to calculate a certain ratio between two metrics for the past month. I created the calculated measure below in DAX:
rate_leads_to_sale_prev_month = CALCULATE(DIVIDE([num_sales], [num_leads], 0), PREVIOUSMONTH('date'[Date]))
However, it does not give me the correct value.
The active relationship is between the [Date] column from the 'date' table and a date column from the main table (1:*) containing the metrics.
Best,
Janine
Solved! Go to Solution.
@janinw, they seem fine, the only other version can be
last MTD Sales ? CALCULATE(DIVIDE([num_sales], [num_leads], 0),DATESMTD(dateadd('Date'[Date],-1,MONTH)))
Can you share sample data and sample output in table format? Or a sample of pbix after deleting sensitive data.
@janinw, they seem fine, the only other version can be
last MTD Sales ? CALCULATE(DIVIDE([num_sales], [num_leads], 0),DATESMTD(dateadd('Date'[Date],-1,MONTH)))
Can you share sample data and sample output in table format? Or a sample of pbix after deleting sensitive data.
Hi Amit,
this seems to do the trick, thanks much! This also seems to work with PREVIOUSMONTH(DATESMTD('Date'[Date])).
Since I would really like to understand why my intial DAX code did not work - could you explain to me what the issue might be with this?
Upon some more reading after receiving your solution I now seem to understand what DATESMTD does, however I still do not see why it does not work without.
Thanks!
Janine
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 | |
81 | |
66 | |
58 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |