Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am trying to create a stacked bar chart based off if a couple of statement is true. I have created an expression which i believe should work but it is not populating my chart.
I am trying to just dive the count of the field MVT when certain values are shown otherwise just count as normal. Any idea if the reason my chart is not populating is due to my expression.
Below is the logic I currently have:
=if(match (MVT,'311','312','411') and MATCH ([Day/Eve],'Day', 'Other')
, count({<MVT={'311','312','411'},[Day/Eve]={'Day', 'Other'}>} MVT)/2,
if(Match (MVT,'201','981') and MATCH ([Day/Eve],'Day', 'Other')
, count({<MVT={'201','981'},[Day/Eve]={'Day', 'Other'}>} MVT)))
Any help is much appreciated
What dimensions are you using? this seems redundant as the conditions are already in your set analysis
You can just create two measures
Measure1 :
count({<MVT={'311','312','411'},[Day/Eve]={'Day', 'Other'}>} MVT)
Measure2:
count({<MVT={'201','981'},[Day/Eve]={'Day', 'Other'}>} MVT)
I currently have two dimensions, one as days of the week and another splitting by shift,
The issue with the first if statement is I need to dived these by count as these get double counted in the system which is why i was trying this.
=if(match (MVT,'311','312','411') and MATCH ([Day/Eve],'Day', 'Other')
, count({<MVT={'311','312','411'},[Day/Eve]={'Day', 'Other'}>} MVT)/2,
Otherwise i want to just count the MVT type once the Day/Eve condition is meet.
Best to remove duplicates from the data
try below
=sum(aggr(if(match (MVT,'311','312','411')
, count({<[Day/Eve]={'Day', 'Other'}>} MVT)/2,
,if(Match (MVT,'201','981')
, count({<[Day/Eve]={'Day', 'Other'}>} MVT))) , Shift,DayofWeek))
I am guessing shift, Day of week should be the field names so have tried the below but still no luck.
=sum(aggr(if(match (MVT,'311','312','411')
, count({<[Day/Eve]={'Day', 'Other'}>} MVT)/2,
,if(Match (MVT,'201','981')
, count({<[Day/Eve]={'Day', 'Other'}>} MVT))) ,[Day/Eve],Day_name))