Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I have and Year field and Month field and Date field.
Now i have straight table and written an expression sum(consumption)*12.
Now i need to divide the expression by number of selected months.
For ex: if i select year 2018 and select five months then in expression i should get sum(consumption)*12/5 and if i select 22 months expression should be sum(consumption)*22. The expression should be what ever months i select the expression should divide by number of months.
Please let me know if you need anything more.
Thanks,
Bharat
You can use GetSelectedCount() -function.
HI
Thanks for your reply.
The problem is when i select 2 years then number of months is showing as 12 instead of 24 when i use get selected count.
If(GetSelectedCount(Year)=0,count(distinct Year),GetSelectedCount(Year))*If(GetSelectedCount(Month)=0,12,GetSelectedCount(12))
Edit:
Another solution would be to include YearMonth dimension into your Calendar.
Your divider should have parantheses (GetSelectedCount(Year)*GetSelectedCount(Month))
But actually a solution provided by MindaugasBacius is the one you should use.