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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
NawilatiMahmoud
Frequent Visitor

How To Write a New Measure to Split/divide/distribute a value when it filtered by Date ' Date Table

Dear Team,

 

I need help in Writing a New Measure to Split/divide/distribute the member premium when it filtered by Date ' Date Table,

the issues is when i filter by the date table it calculte the sum with all amounts based only on the member effcitive date, which is wrong in my example, as I need the DAX in the measure to distribute member premium equaly by days based on the filter duration that i will use , below youll find a screenshot of my data.

 

Note : I may need a soulation in measurment calculation not in Power Querry as my data is very huge and i can not split it per daye for all records.

 

 

Member Effective DateMember Ineffective DateMember Premium
 01/01/2022 04/07/2022246.51
 01/01/2022 04/07/2022246.51
 01/01/2022 04/07/2022210.718
 01/01/2022 04/07/2022210.718
 01/01/2022 04/07/2022210.718
 01/01/2022 04/07/2022210.718
 01/01/2022 04/07/2022210.718
 01/01/2022 30/09/2022364.405
 01/01/2022 30/09/2022364.405
 01/01/2022 30/09/2022364.405
 01/01/2022 30/09/2022364.405
 01/01/2022 30/09/2022311.496
1 ACCEPTED SOLUTION

@NawilatiMahmoud , refer if this can help

Measure way
Power BI Dax Measure- Allocate data between Range: https://youtu.be/O653vwLTUzM
https://community.powerbi.com/t5/Community-Blog/How-to-divide-distribute-values-between-start-date-o...

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

5 REPLIES 5
v-zhangti
Community Support
Community Support

Hi, @NawilatiMahmoud 

 

You can try the following methods.

Column:

Total = 
CALCULATE ( SUM ( 'Table'[Member Premium] ),
    ALLEXCEPT ( 'Table',
        'Table'[Member Effective Date],
        'Table'[Member Ineffective Date]
    )
)

vzhangti_0-1672737046852.png

Measure:

Maxdate = IF(MAX('Date'[Date])<=SELECTEDVALUE('Table'[Member Ineffective Date]),MAX('Date'[Date]),SELECTEDVALUE('Table'[Member Ineffective Date]))
Mindate = IF(MIN('Date'[Date])<=SELECTEDVALUE('Table'[Member Effective Date]),SELECTEDVALUE('Table'[Member Effective Date]),MIN('Date'[Date]))
Measure = 
Var _datediff=DATEDIFF([Mindate],[Maxdate],DAY)
Return
DIVIDE(SUM('Table'[Total]),_datediff)

vzhangti_1-1672737141180.pngvzhangti_2-1672737168315.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you dear, but the below solution was easier for me, thank you for your reply and support

NawilatiMahmoud
Frequent Visitor

Another Note : the distribute member premium should be calculated btween the duration of the start and end date, as if i filter the date more than the end date for any members he will be excluded, and if i start my date filter before the start end, the measure should calculate only the days that incloded in the filter.

@NawilatiMahmoud , refer if this can help

Measure way
Power BI Dax Measure- Allocate data between Range: https://youtu.be/O653vwLTUzM
https://community.powerbi.com/t5/Community-Blog/How-to-divide-distribute-values-between-start-date-o...

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thank Dear. Amitchandaj,

 

it solve my issue correctly 🙂

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

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