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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Calculation error in YTD due to duplicates

Hi Experts,

I have written the formula for ytd as below:

TotalGWPYTD = calculate(SUM ( PolBudget[Total Gross Premium] ), VALUE(PolBudget[Year]) = YEAR ( TODAY () ) )
and got the expected result, but there are some cases where i am getting duplicate values as below under UW type (second column) due to which the year instead of coming 2022 it is taking years in descending based on number of duplicate values:
Vaibhav_rathore_0-1659950315706.png

 

 

Please advise the solution either to remove the duplicates or to fix the year part.

 

Thanks

 
 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @Anonymous ,

I created some data:

vyangliumsft_0-1661317628723.png

Here are the steps you can follow:

1. Create measure.

Flag =
IF(
    MAX('PolBudget'[Year])=YEAR(TODAY()),1,0)
TotalGWPYTD =
SUMX(ALLSELECTED('PolBudget'),[Total Gross Premium])

2. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_1-1661317628731.png

3. Result:

vyangliumsft_2-1661317628737.png

If you need pbix, please click here.

Calculation error in YTD due to duplicates.pbix

 

Best Regards,

Liu Yang

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

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi  @Anonymous ,

I created some data:

vyangliumsft_0-1661317628723.png

Here are the steps you can follow:

1. Create measure.

Flag =
IF(
    MAX('PolBudget'[Year])=YEAR(TODAY()),1,0)
TotalGWPYTD =
SUMX(ALLSELECTED('PolBudget'),[Total Gross Premium])

2. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_1-1661317628731.png

3. Result:

vyangliumsft_2-1661317628737.png

If you need pbix, please click here.

Calculation error in YTD due to duplicates.pbix

 

Best Regards,

Liu Yang

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

amitchandak
Super User
Super User

@Anonymous , try like

TotalGWPYTD = calculate(SUM ( PolBudget[Total Gross Premium] ), Filter(PolBudget, PolBudget[Year]) = YEAR ( TODAY () ) )

 

 

refer if needed

https://medium.com/chandakamit/cheat-sheet-power-bi-time-intelligence-formulas-using-today-654f26e27304

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hi @amitchandak 

I am getting this error:

Vaibhav_rathore_0-1660030156549.png

Thanks

 

Dinesh_Suranga
Continued Contributor
Continued Contributor

@Anonymous ,

Please check the data type of PolBudget[Year].

Thank you.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.