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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
PBIDEV_10
Helper II
Helper II

YTD calculation issue

Hello experts!

I have a calculation for new members where it says till 31.05.2021(CutOverDate) read value from source 2 else from source 1 (Total new members = IF(MAX(Calendar[Date])>= [CutOverDate],[Members source 1], [Members source 2])). This measure shows correct values. But when I use it in YTD calculation (CALCULATE([Total new members],DATESYTD(Calendar[Date])), for the value of june 2021, it shows summed value for jan21 to june21 from source 1 and ignores the logic for Total new members. Please refer to the pic below. For June 2021 instead of showing 19955 it should show 13834(10869+2965). How to get YTD calculation right?

 
PBIDEV_10_0-1632213597460.png

 

Regards

PP

1 ACCEPTED SOLUTION
FarhanAhmed
Community Champion
Community Champion

I think first You should create a New intermediate measure to calculate the correct calculation for totals.

Total  Members = 
SUMX(VALUES(Dates[Month & Year]),[Total new members])

 

Now, this measure should be used in YTD measure to get correct YTD numbers.

 

 

 







Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!

Proud to be a Super User!




View solution in original post

5 REPLIES 5
FarhanAhmed
Community Champion
Community Champion

I think first You should create a New intermediate measure to calculate the correct calculation for totals.

Total  Members = 
SUMX(VALUES(Dates[Month & Year]),[Total new members])

 

Now, this measure should be used in YTD measure to get correct YTD numbers.

 

 

 







Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!

Proud to be a Super User!




@FarhanAhmed : Thank you for your tip. It worked. But instead of month, I used date since user needs to drill down till day level. (Total members test = SUMX(VALUES(Calendar[Date]),[Total new members])). When I use it in the report then it takes lot of time to process the data than before. Can I do anything to load the data faster?

See if this helps 

 

Optimizing DAX expressions involving multiple measures - SQLBI

 







Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!

Proud to be a Super User!




amitchandak
Super User
Super User

@PBIDEV_10 make sure calendar is marked as date table and you are using year, month, and month name from calendar table

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

@amitchandak Yes. Calendar is marked as a date table and I am using year, month from the same table.

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 MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.