Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
vsharma1
Partner - Creator
Partner - Creator

calculate No fo Months in Year

Hi,

I want to calculate number of months  yearwise based on calendar table
I am doing count(yearmonth) to calculate number of months , yearmonth is column in calendar table

when i am adding other dimension in my chart it is giving wrong value 3 instead of 5 for current year 2019 

17 Replies
dplr-rn
Partner - Master III
Partner - Master III

agree with rob.
count(TOTAL<Year> YearMonth)
will work to just count the number of months
dplr-rn
Partner - Master III
Partner - Master III

Wanted to add i think there is an issue with your data . atleast in the sample e.g. Claim data has YearMonth as 20193 and TimePeriod table has YearMonth as 201903

Maybe its just the sample data
vsharma1
Partner - Creator
Partner - Creator
Author

Yes , it was sample data, i tried your solution on sample data , its working thanks

I will try on real data and will let you know thanks!!

vsharma1
Partner - Creator
Partner - Creator
Author

its not working actually

vsharma1
Partner - Creator
Partner - Creator
Author

sorry, i forgot to mention there is a data for 12 months in my calendar table for 2019, in this case count(TOTAL<Year> YearMonth) is giving me 12 always instead of 5

vsharma1
Partner - Creator
Partner - Creator
Author

i tried if( Year= year(today()), SubField(today(),'/',1),12) which is working on sample data but not working on real data , it looks like condition Year= year(today()) being ignored always and this formula giving me always 12 result

vsharma1
Partner - Creator
Partner - Creator
Author

attached is sample data

dimension used in chart is YTDComparison

Capture1.JPG

vsharma1
Partner - Creator
Partner - Creator
Author

you can see value 3 which is incorrect , it should be 5