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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
sanjaymithran
Helper I
Helper I

How to calculate IRR using DAX

Hi All,

XIRR=XIRR(Data,Data[Cash Flow],Data[DATE]) working fine we have function getting same as mentioned below.

I tried as explained  in that video getting 0% but in excel 0.45%

IRR =
XIRR (
ADDCOLUMNS (
'Data',
"Date365", CALCULATE (
COUNTROWS ( 'Data' ),
'Data'[DATE] < EARLIER ( Data[DATE]),
ALL ( 'Data' )
)
* 365
+ CALCULATE ( MIN ( Data[DATE] ), ALL ( 'Data') )
),
Data[Cash Flow],
[Date365]
) )

 

SPONSORDATEYearMonthCash Flow IRRXIRR
Sponsor11/1/2000 0:0000-509060.5 0.45%0.80%
Sponsor11/1/2023 0:00119789.92   
Sponsor12/1/2023 0:00129573.44   
Sponsor13/1/2023 0:00139361.79   
Sponsor14/1/2023 0:00149154.88   
Sponsor15/1/2023 0:00158952.62   
Sponsor16/1/2023 0:00168754.88   
Sponsor17/1/2023 0:00178561.59   
Sponsor18/1/2023 0:00188372.61   
Sponsor19/1/2023 0:00198187.85   
Sponsor110/1/2023 0:001108007.23   
Sponsor111/1/2023 0:001117830.64   
Sponsor112/1/2023 0:001127658.02   
Sponsor11/1/2024 0:00217489.25   
Sponsor12/1/2024 0:00227391.31   
Sponsor13/1/2024 0:00237294.71   
Sponsor14/1/2024 0:00247199.45   
Sponsor15/1/2024 0:00257105.49   
Sponsor16/1/2024 0:00267012.8   
Sponsor17/1/2024 0:00276921.4   
Sponsor18/1/2024 0:00286831.23   
Sponsor19/1/2024 0:00296742.31   
Sponsor110/1/2024 0:002106654.57   
Sponsor111/1/2024 0:002116568.05   
Sponsor112/1/2024 0:002126482.69   
Sponsor11/1/2025 0:00316398.52   
Sponsor12/1/2025 0:00326348.35   
Sponsor13/1/2025 0:00336298.69   
Sponsor14/1/2025 0:00346249.54   
Sponsor15/1/2025 0:00356200.88   
Sponsor16/1/2025 0:00366152.69   
Sponsor17/1/2025 0:00376104.98   
Sponsor18/1/2025 0:00386057.76   
Sponsor19/1/2025 0:00396010.98   
Sponsor110/1/2025 0:003105964.67   
Sponsor111/1/2025 0:003115918.82   
Sponsor112/1/2025 0:003125873.42   
Sponsor11/1/2026 0:00415828.43   
Sponsor12/1/2026 0:00425778.2   
Sponsor13/1/2026 0:00435728.42   
Sponsor14/1/2026 0:00445679.05   
Sponsor15/1/2026 0:00455630.16   
Sponsor16/1/2026 0:00465581.65   
Sponsor17/1/2026 0:00475533.6   
Sponsor18/1/2026 0:00485485.98   
Sponsor19/1/2026 0:00495438.77   
Sponsor110/1/2026 0:004105391.97   
Sponsor111/1/2026 0:004115345.59   
Sponsor112/1/2026 0:004125299.6   
Sponsor11/1/2027 0:00515254.03   
Sponsor12/1/2027 0:00525219.4   
Sponsor13/1/2027 0:00535184.97   
Sponsor14/1/2027 0:00545150.8   
Sponsor15/1/2027 0:00555116.88   
Sponsor16/1/2027 0:00565083.17   
Sponsor17/1/2027 0:00575049.7   
Sponsor18/1/2027 0:00585016.46   
Sponsor19/1/2027 0:00594983.44   
Sponsor110/1/2027 0:005104950.64   
Sponsor111/1/2027 0:005114918.09   
Sponsor112/1/2027 0:005124885.75   
Sponsor11/1/2028 0:00614853.62   
Sponsor12/1/2028 0:00624821.73   
Sponsor13/1/2028 0:00634790.04   
Sponsor14/1/2028 0:00644758.59   
Sponsor15/1/2028 0:00654727.35   
Sponsor16/1/2028 0:00664696.34   
Sponsor17/1/2028 0:00674665.53   
Sponsor18/1/2028 0:00684634.91   
Sponsor19/1/2028 0:00694604.51   
Sponsor110/1/2028 0:006104574.33   
Sponsor111/1/2028 0:006114544.35   
Sponsor112/1/2028 0:006124514.58   
Sponsor11/1/2029 0:00714485   
Sponsor12/1/2029 0:00724456.19   
Sponsor13/1/2029 0:00734427.57   
Sponsor14/1/2029 0:00744399.16   
Sponsor15/1/2029 0:00754370.92   
Sponsor16/1/2029 0:00764342.89   
Sponsor17/1/2029 0:00774315.02   
Sponsor18/1/2029 0:00784287.34   
Sponsor19/1/2029 0:00794259.85   
Sponsor110/1/2029 0:007104232.53   
Sponsor111/1/2029 0:007114205.39   
Sponsor112/1/2029 0:007124178.45   
Sponsor11/1/2030 0:00814151.68   
Sponsor12/1/2030 0:00824125.11   
Sponsor13/1/2030 0:00834098.69   
Sponsor14/1/2030 0:00844072.44   
Sponsor15/1/2030 0:00854046.41   
Sponsor16/1/2030 0:00864020.5   
Sponsor17/1/2030 0:00873994.78   
Sponsor18/1/2030 0:00883969.25   
Sponsor19/1/2030 0:00893943.87   
Sponsor110/1/2030 0:008103918.65   
Sponsor111/1/2030 0:008113893.6   
Sponsor112/1/2030 0:008123868.74   
Sponsor11/1/2031 0:00913844.02   
Sponsor12/1/2031 0:00923819.47   
Sponsor13/1/2031 0:00933795.1   
Sponsor14/1/2031 0:00943770.86   
Sponsor15/1/2031 0:00953746.79   
Sponsor16/1/2031 0:00963722.89   
Sponsor17/1/2031 0:00973699.16   
Sponsor18/1/2031 0:00983675.55   
Sponsor19/1/2031 0:00993652.13   
Sponsor110/1/2031 0:009103628.84   
Sponsor111/1/2031 0:009113605.72   
Sponsor112/1/2031 0:009123582.75   
Sponsor11/1/2032 0:001013559.94   
Sponsor12/1/2032 0:001023537.27   
Sponsor13/1/2032 0:001033514.73   
Sponsor14/1/2032 0:001043492.36   
Sponsor15/1/2032 0:001053470.12   
Sponsor16/1/2032 0:001063448.06   
Sponsor17/1/2032 0:001073426.12   
Sponsor18/1/2032 0:001083404.32   
Sponsor19/1/2032 0:001093382.67   
Sponsor110/1/2032 0:0010103361.18   
Sponsor111/1/2032 0:0010113339.83   
Sponsor112/1/2032 0:0010123318.6   
1 ACCEPTED SOLUTION
OwenAuger
Super User
Super User

Hi @sanjaymithran 

I loaded your Data table exactly as in your post, and tried your IRR measure, and did get a result of 0.45%.

See attached PBIX.

 

To confirm, do you want to replicate the behaviour of the Excel IRR function, which takes an ordered list of cashflows and assumes they occur at 1-year intervals (in this case by ignoring the DATE column)?

 

You can also write this more simply as something like this:

IRR 2 = 
XIRR (
    'Data',
    Data[Cash Flow],
    RANK ( DENSE, ALL ( 'Data'[DATE] ) )
        * 365
)

The interval between the Date values is important, rather than their magnitude, so there is no need to add the minimum date.

 

Please post back if needed.

Regards


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

View solution in original post

2 REPLIES 2
OwenAuger
Super User
Super User

Hi @sanjaymithran 

I loaded your Data table exactly as in your post, and tried your IRR measure, and did get a result of 0.45%.

See attached PBIX.

 

To confirm, do you want to replicate the behaviour of the Excel IRR function, which takes an ordered list of cashflows and assumes they occur at 1-year intervals (in this case by ignoring the DATE column)?

 

You can also write this more simply as something like this:

IRR 2 = 
XIRR (
    'Data',
    Data[Cash Flow],
    RANK ( DENSE, ALL ( 'Data'[DATE] ) )
        * 365
)

The interval between the Date values is important, rather than their magnitude, so there is no need to add the minimum date.

 

Please post back if needed.

Regards


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

Hi OwenAuger,

Thanks for reply,the below one is detail data for which i posted yesteday is summary,same formula apply here not getting correct result its show 0% instead of 0.45% we have country,sponsor and Launch date slicer

sanjaymithran_0-1691676626820.png

Not able to attach file will split send agail

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.