Forum Discussion
Dax for finding conversion rate
- Anonymous4 years ago
Hi Anonymous ,
I created a sample pbix file(see attachment) for you, please check whether that is what you want.
1. Create the two calculated columns as below to get the special week number
StartdayofWeek = 'Table'[Date] + -1 * IF ( WEEKDAY ( 'Table'[Date] ) < 6, WEEKDAY ( 'Table'[Date] ) + 1, WEEKDAY ( 'Table'[Date] ) - 6 )Week = 1 + WEEKNUM ( 'Table'[StartdayofWeek], 1 ) - WEEKNUM ( STARTOFMONTH ( 'Table'[StartdayofWeek] ), 1 )2. Create a measure as below to get the conversion rate
Conversion rate = VAR _appcount = SUM ( 'Table'[Application Count] ) VAR _premonthinqcount = CALCULATE ( SUM ( 'Table'[Inquiry Count] ), FILTER ( ALLSELECTED ( 'Table' ), YEAR ( 'Table'[Date] ) = SELECTEDVALUE ( 'Table'[Date].[Year] ) && MONTH ( 'Table'[Date] ) = SELECTEDVALUE ( 'Table'[Date].[MonthNo] ) - 1 && 'Table'[Week] = SELECTEDVALUE ( 'Table'[Week] ) ) ) RETURN DIVIDE ( _appcount, _premonthinqcount, 0 )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.
How to upload PBI in Community
Best Regards
Hi Anonymous ,
I created a sample pbix file(see attachment) for you, please check whether that is what you want.
1. Create the two calculated columns as below to get the special week number
StartdayofWeek = 'Table'[Date]
+ -1
* IF (
WEEKDAY ( 'Table'[Date] ) < 6,
WEEKDAY ( 'Table'[Date] ) + 1,
WEEKDAY ( 'Table'[Date] ) - 6
)Week =
1 + WEEKNUM ( 'Table'[StartdayofWeek], 1 )
- WEEKNUM ( STARTOFMONTH ( 'Table'[StartdayofWeek] ), 1 )
2. Create a measure as below to get the conversion rate
Conversion rate =
VAR _appcount =
SUM ( 'Table'[Application Count] )
VAR _premonthinqcount =
CALCULATE (
SUM ( 'Table'[Inquiry Count] ),
FILTER (
ALLSELECTED ( 'Table' ),
YEAR ( 'Table'[Date] ) = SELECTEDVALUE ( 'Table'[Date].[Year] )
&& MONTH ( 'Table'[Date] )
= SELECTEDVALUE ( 'Table'[Date].[MonthNo] ) - 1
&& 'Table'[Week] = SELECTEDVALUE ( 'Table'[Week] )
)
)
RETURN
DIVIDE ( _appcount, _premonthinqcount, 0 )
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.
How to upload PBI in Community
Best Regards