cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MaliniB
Helper II
Helper II

YTD function for categorical variable

Hi, 

I am trying to create an YTD for an count of categorical variable for each event type. The data is similar to this. Now I have to create a count of rating difference from 2021-2022. How do I proceed with that ?

I used this 

RATING_YTD = TOTALYTD(Count(Sheet0[Rating]),Sheet0[Response Date].[Date],Sheet0[Rating]="Promoters")
but it doesnot seem to work. Am I doing it correct ?

MaliniB_0-1654055693262.png

 

1 ACCEPTED SOLUTION
v-cazheng-msft
Community Support
Community Support

Hi @MaliniB,

 

You may try this solution.

1 Make some changes to your Measure

RATING_YTD = TOTALYTD(Count(Sheet0[rating]),Sheet0[response date].[Date])

 

2 Create a visual like this

vcazhengmsft_1-1654505408945.png

 

Also, attached the sample pbix file.

 

For more details about TotalYTD, you may take a look at Year to Date; TotalYTD part of this blog: Basics of Time Intelligence in DAX for Power BI; Year to Date, Quarter to Date, Month to Date - RADA...

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!

 

Best Regards,

Community Support Team _ Caiyun

View solution in original post

2 REPLIES 2
v-cazheng-msft
Community Support
Community Support

Hi @MaliniB,

 

You may try this solution.

1 Make some changes to your Measure

RATING_YTD = TOTALYTD(Count(Sheet0[rating]),Sheet0[response date].[Date])

 

2 Create a visual like this

vcazhengmsft_1-1654505408945.png

 

Also, attached the sample pbix file.

 

For more details about TotalYTD, you may take a look at Year to Date; TotalYTD part of this blog: Basics of Time Intelligence in DAX for Power BI; Year to Date, Quarter to Date, Month to Date - RADA...

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!

 

Best Regards,

Community Support Team _ Caiyun

ValtteriN
Super User
Super User

Hi,

Try something like this:


Data:

ValtteriN_1-1654066356945.png

 


Model:

ValtteriN_0-1654066327063.png

DAX:

ytd category = CALCULATE(COUNT('Category YTD'[Type]),DATESYTD('Calendar'[Date]))


End result:

ValtteriN_2-1654066602856.png

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/





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

Proud to be a Super User!




Helpful resources

Announcements
November 2022 Update

Check it Out!

Click here to read more about the November 2022 updates!

European Share Point Conference

European Share Point Conference

This conference returns live and in-person in Copenhagen this 28 November-01 December with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Microsoft 365 Conference â__ December 6-8, 2022

Microsoft 365 Conference - 06-08 December

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Top Solution Authors