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

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.

Reply
Anonymous
Not applicable

Calculation of Exposure in dax

Hello every one 
I have Exposure formula in qlik which i have to convert in power BI, The expected outcome is not coming from dax formula.
Could you please guide me for this. 
Formula:
 sum((RangeMax(0,RangeMin( (vPE_Date) - Policy_Effective_Date + 1, Policy_End_Date -Policy_Effective_Date + 1)))/((Policy_End_Date) - (Policy_Effective_Date) +1))

MM_Exposure2 =
var Sum1= Sumx(Premium, Premium[Pol_Date_Diff])
var Vpe_date = DATE(2021,3,31)
var Earned_Duration = MAX(0,Min( 1+(DATEDIFF(Vpe_date,Min(Premium[Policy_Effective_Date_Code]),DAY)),Sum1)) Return Sumx(Premium,1+(DATEDIFF(Min(PolEffective_Calendar[Policy_Effective_Date]),Vpe_date,DAY)))
@amitchandak 

6 REPLIES 6
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

 

I don't have experience with Qlik functions. Could you use some sample data and expected result to explain what this Qlik formula is calculating?

 

If I understand it correctly, you can create a new column with the following DAX code.

Column = 
var vPE_Date = DATE(2022,3,31)
var v_Duration_1 = DATEDIFF(Premium[Policy_Effective_Date], vPE_Date, DAY) + 1
var v_Duration_2 = DATEDIFF(Premium[Policy_Effective_Date], Premium[Policy_End_Date], DAY) + 1
return
DIVIDE(MAX(0, MIN(v_Duration_1, v_Duration_2)), v_Duration_2)

vjingzhang_0-1652075442198.png

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

Anonymous
Not applicable

Hi @v-jingzhang 
Thanks for reply
The Vpe_Date should be dynamic Date and Total formula values is   1.png

Picture2.pngPicture3.pngThese are calculated columns and the result of both is correct but total is not matching which is 991,409

Hi @Anonymous

 

Calculated columns cannot be dynamic. If the Vpe_Date should be dynamic, you need to use measures to get dynamic results. Do you use a slicer or filter to pick a dynamic Vpe_Date date?

 

Jing

Anonymous
Not applicable

Ok @v-jingzhang if vpe_date is hardcoded then again the measure is not showing correct value.
Thanks

Hi @Anonymous 

 

Can you please share some mock data and expected result based on it? Or can you help explain how to calculate the expected result with natural language and some example? Currently I still don't understand what the expected result should be. Maybe you want to calculate the duration days between all dates in a column and a dynamic vpe_date date, then sum up all duration days? 

 

Jing

Anonymous
Not applicable

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.