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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
vengadesh_p
Helper I
Helper I

Need Dax help to achive extended Warrenty AMT Calculation

Hi all,

I have data like the image below

vengadesh_p_0-1747048662582.png
Based on that, i want to show a table like below Image

vengadesh_p_1-1747048777343.png

Logic:
I want to split the Warranty amount based on the number of months between the Warranty End Date to Extended Warranty End Date

Ex: For ID1 Warranty AMT is 3600, Number of months Extended Warranty is 36, so 100rs per Month from Extended Warranty Start to End 

Data 

IDPurchase DateWarranty End DateExtended Warranty End DateWarrenty AMT
ID11 January 20211 January 20231 January 20263600
ID21 May 20211 May 20231 May 20263600
ID31 July 20211 July 20231 July 20263600
ID41 July 20211 July 20231 July 20261800


Thanks

 

1 ACCEPTED SOLUTION

Hi @vengadesh_p,

 

Issue was with the DAX, generateseries function, I've updated the DAX, 

WarrantySpreadMonthly =
ADDCOLUMNS (
    GENERATE (
        'Data',
        VAR StartDate = 'Data'[Warraty date]
        VAR EndDate = 'Data'[Extended Warranty Date]
        VAR NumMonths = DATEDIFF(StartDate, EndDate, MONTH)
        RETURN
            ADDCOLUMNS (
                GENERATESERIES(0, NumMonths - 1, 1),
                "MonthDate", EDATE(StartDate, [Value])
            )
    ),
    "MonthlyAmount",
        DIVIDE (
            'Data'[Amount],
            DATEDIFF('Data'[Warraty date], 'Data'[Extended Warranty Date], MONTH),
            0
        ),
    "PurchaseMonth", FORMAT('Data'[Purchase date], "mmm-yyyy"),
    "WarrantyEndMonth", FORMAT([MonthDate], "mmm-yyyy"),
    "WarrantyEndMonthSort", YEAR([MonthDate]) * 100 + MONTH([MonthDate])
)
It should not show correct values
 grazitti_sapna_1-1747062475378.png

🌟 I hope this solution helps you unlock your Power BI potential! If you found it helpful, click 'Mark as Solution' to guide others toward the answers they need.
💡 Love the effort? Drop the kudos! Your appreciation fuels community spirit and innovation.
🎖 As a proud SuperUser and Microsoft Partner, we’re here to empower your data journey and the Power BI Community at large.
🔗 Curious to explore more? [Discover here].
Let’s keep building smarter solutions together!

View solution in original post

3 REPLIES 3
grazitti_sapna
Super User
Super User

Hi @vengadesh_p,

 

To achieve this, you need to create a new table, use below dax to create new table

 

WarrantySpreadMonthly =
ADDCOLUMNS (
    GENERATE (
        'Data',  -- Replace with your actual table name
        VAR StartDate = 'Data'[Warraty date]
        VAR EndDate = 'Data'[Extended Warranty Date]
        VAR NumMonths = DATEDIFF(StartDate, EndDate, MONTH)
        RETURN
            ADDCOLUMNS (
                GENERATESERIES(1, NumMonths, 1),
                "MonthDate", EDATE(StartDate, [Value])
            )
    ),
    "MonthlyAmount",
        DIVIDE (
            'Data'[Amount],
            DATEDIFF (
                'Data'[Warraty date],
                'Data'[Extended Warranty Date],
                MONTH
            ),
            0
        ),
    "PurchaseMonth", FORMAT('Data'[Purchase date], "mmm-yyyy"),
    "WarrantyEndMonth", FORMAT([MonthDate], "mmm-yyyy"),
    "WarrantyEndMonthSort", YEAR([MonthDate]) * 100 + MONTH([MonthDate])
)
Once done you can add the Purchase date to Row and Warranty end date to column and sum(Amount), Please see the attached example .pbix file.
🌟 I hope this solution helps you unlock your Power BI potential! If you found it helpful, click 'Mark as Solution' to guide others toward the answers they need.
💡 Love the effort? Drop the kudos! Your appreciation fuels community spirit and innovation.
🎖 As a proud SuperUser and Microsoft Partner, we’re here to empower your data journey and the Power BI Community at large.
🔗 Curious to explore more? [Discover here].
Let’s keep building smarter solutions together!
 

Hi Thanks for your Solution. 

Based on below screenshot, I want to make a little bit of changes to your logic

Thank you once again

vengadesh_p_0-1747057866907.png

 

vengadesh_p_1-1747057971231.png

 

Hi @vengadesh_p,

 

Issue was with the DAX, generateseries function, I've updated the DAX, 

WarrantySpreadMonthly =
ADDCOLUMNS (
    GENERATE (
        'Data',
        VAR StartDate = 'Data'[Warraty date]
        VAR EndDate = 'Data'[Extended Warranty Date]
        VAR NumMonths = DATEDIFF(StartDate, EndDate, MONTH)
        RETURN
            ADDCOLUMNS (
                GENERATESERIES(0, NumMonths - 1, 1),
                "MonthDate", EDATE(StartDate, [Value])
            )
    ),
    "MonthlyAmount",
        DIVIDE (
            'Data'[Amount],
            DATEDIFF('Data'[Warraty date], 'Data'[Extended Warranty Date], MONTH),
            0
        ),
    "PurchaseMonth", FORMAT('Data'[Purchase date], "mmm-yyyy"),
    "WarrantyEndMonth", FORMAT([MonthDate], "mmm-yyyy"),
    "WarrantyEndMonthSort", YEAR([MonthDate]) * 100 + MONTH([MonthDate])
)
It should not show correct values
 grazitti_sapna_1-1747062475378.png

🌟 I hope this solution helps you unlock your Power BI potential! If you found it helpful, click 'Mark as Solution' to guide others toward the answers they need.
💡 Love the effort? Drop the kudos! Your appreciation fuels community spirit and innovation.
🎖 As a proud SuperUser and Microsoft Partner, we’re here to empower your data journey and the Power BI Community at large.
🔗 Curious to explore more? [Discover here].
Let’s keep building smarter solutions together!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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