cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

How this Dax is working ?

Hi,

I don't have experience with DAX and I'm trying to understand a DAX which is used in a workbook.

Here is the link to workbook. https://community.tableau.com/servlet/JiveServlet/download/847360-289331/SampleData.xlsx


This is the formula which is used to calculate earned exposure.

=SUMX (
SUMMARIZE (
Table2,
Table2[InceptionDate],
Table2[ExpiryDate],
"Earned Exposure",
COUNTA(Table2[Policy Name])
* COUNTROWS (
CALCULATETABLE ('Table1',
KEEPFILTERS(
DATESBETWEEN (
Table1[DateKey],Table2[InceptionDate], Table2[ExpiryDate]
)
)
)
)
/ COUNTROWS (
DATESBETWEEN (
Table1[DateKey],Table2[InceptionDate], Table2[ExpiryDate]

)
)
),
[Earned Exposure]
)



Please help me to understand how earned exposure is calculated in Sheet1 for each month using above formulae.

MonthEarned Exposure
10.855191257
20.765027322
30.846994536


Regards,
Ombir

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: How this Dax is working ?

Hi @Anonymous,

 

Description of formula segmentation:

 

SUMMARIZE ( Table2, Table2[InceptionDate], Table2[ExpiryDate],"Earned Exposure",expressions)

Summarize table based on two date columns and add custom column with following expressions.

 

COUNTA(Table2[Policy Name])

Calculate related 'policy name' count based on summarize columns.

 

COUNTROWS (CALCULATETABLE ('Table1',KEEPFILTERS (DATESBETWEEN ( Table1[DateKey], Table2[InceptionDate], Table2[ExpiryDate] ))))

 Filtered table1 row count based condition 'datekey' field in date range which defined by current row 'InceptionDate' and 'ExpiryDatefunction'.

 

COUNTROWS ( DATESBETWEEN ( Table1[DateKey], Table2[InceptionDate], Table2[ExpiryDate] ) )

Filtered datekey fields count in current date range.

 

SUMX (SummarizeTable,[Earned Exposure])

Get summarize of new column based on category fields in table visual.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin Sheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.



For learning resources/Release notes, please visit: | |

View solution in original post

1 REPLY 1
Community Support Team
Community Support Team

Re: How this Dax is working ?

Hi @Anonymous,

 

Description of formula segmentation:

 

SUMMARIZE ( Table2, Table2[InceptionDate], Table2[ExpiryDate],"Earned Exposure",expressions)

Summarize table based on two date columns and add custom column with following expressions.

 

COUNTA(Table2[Policy Name])

Calculate related 'policy name' count based on summarize columns.

 

COUNTROWS (CALCULATETABLE ('Table1',KEEPFILTERS (DATESBETWEEN ( Table1[DateKey], Table2[InceptionDate], Table2[ExpiryDate] ))))

 Filtered table1 row count based condition 'datekey' field in date range which defined by current row 'InceptionDate' and 'ExpiryDatefunction'.

 

COUNTROWS ( DATESBETWEEN ( Table1[DateKey], Table2[InceptionDate], Table2[ExpiryDate] ) )

Filtered datekey fields count in current date range.

 

SUMX (SummarizeTable,[Earned Exposure])

Get summarize of new column based on category fields in table visual.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin Sheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.



For learning resources/Release notes, please visit: | |

View solution in original post

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 358 members 3,378 guests
Please welcome our newest community members: