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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

how use TOTALYTD even when not all the data is available at the same period

Hello everyone !

 

I have the following scenario where I need to calculate the YTD value for each channel.

However, for the january, I don't usually have the data for all the channels so when using TOTALYTD, it calculates the YTD of the previous year for some channels year whereas I would like to use the max last avaibale date for all the channels

 

Instead, I'm using CALCULATE function along with DATESBETWEEN to get the desired output and I was wondering if there is a different way to do it. 

 

Here is my formula and in comments the section that i don't use anymore 

YTD calculation.PNG

And here is the result when using TOTALYTD:

ytdResults.PNG

 

 

 

 

 

 

 

As you can see when using the TOTALYTD function, it returns values for all channels, however, it's supposed to only return 11 for "Face to Face" channel since my last avaib date in my table is January and I would like to display the results only for january.

I guess I could change my formula to check if there is no data for the latest available month then return a 0 else use the TOTALYTD formula as showen bellow but I'm still curious if there is another way to use TOTALYTD to "force" a certain context 

 

change formula.PNG

 

 

 

 

Looking forward to your replies,

Cheers,

Mariem

4 REPLIES 4
v-yangliu-msft
Community Support
Community Support

Hi  @Anonymous  ,

I created some data:

v-yangliu-msft_0-1612486025724.png

1. You can directly specify the date to get YTD

Measure =
CALCULATE(SUM('date'[amount]),FILTER('date','date'[date]>=date(YEAR(TODAY()),1,1)&&'date'[date]<=TODAY()))

 2. Result.

v-yangliu-msft_1-1612486025725.png

 

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.

VijayP
Super User
Super User

@Anonymous 

Can you share the dummy pbix to resolve it!




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


Anonymous
Not applicable

Hi @VijayP 

I have tried that and it didn't work, here's how i changed my formula:

 
TOTALYTD (
     [activityMetric],
     FactActivity[MONTHDAY_DT], 
     FactActivity[MONTHDAY_DT] <= monthToUseCY
)
VijayP
Super User
Super User

@Anonymous 

in TOTALYTD try using Year End Date argument , to specify where you Data to end 




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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