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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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:

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

Thanks

1 ACCEPTED SOLUTION
Community Support

Hi  @Anonymous ,

I created some data:

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.

3. Result:

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

4 REPLIES 4
Community Support

Hi  @Anonymous ,

I created some data:

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.

3. Result:

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

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

Anonymous
Not applicable

I am getting this error:

Thanks

Continued Contributor

@Anonymous ,

Please check the data type of PolBudget[Year].

Thank you.

## Helpful resources

Announcements

#### New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

#### Power BI Monthly Update - May 2024

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

#### Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors