12-05-2018 03:47 AM
Hi i'm connecting to our DW through an SSAS live connection. Star schema roughly as follows:
dimCustomer - list of customers
dimEngagementType - list of possible actions a customer can take to engage with us (e.g. registered for webinar)
factCustomerEngagement - transaction fact of all customer engagements
I've been given the following requirement: show me all customers who performed a particular action (e.g. registered for webinar) and then show me all other actions they took and when
So essentially i need to filter the fact table twice. Once on engagement type to get the list of customers who performed the particular action. Then i need to re-filter it using that customer list to show me what else they did.
Can i do this in DAX? I come from a SQL background so trying to rewire my brain.
Thanks for any help.
12-05-2018 04:12 AM
you can query SSAS using DAX so it would return a table - which would be very SQL thing to do, and I don't recommend it
what would more DAX focused approach is following:
1) create a measure that shows nr of engagements, e.g.
NrOfEnagements = COUNTROWS(factCustomerEngagement) -- assuming that each row is single engagement
2) crate a visual using Customer Name from dimCustomer and [NrOfEnagements ] - it will only show customers that have engaged, and the number of such actions
2) if you then use slicer to filter e.g. 'registered for webinar' in dimEngagementType it will pass the filter from the slicer to the visual, effectively showing all the customers that have made that action and the number of such actions
you could also write it explicitely like this:
NrOfRegistrations = CALCULATE( COUNTROWS(factCustomerEngagement), dimEngagementType[Action] = "registered for webinar" )
or referencing the first measure
NrOfRegistrations = CALCULATE( [NrOfEngagements], dimEngagementType[Action] = "registered for webinar" )
12-06-2018 06:20 AM
Thanks for the response, really appreciate it. However won't those formulas just give me a count by engagement type? What i need to answer is:
Of the 5 people who registered for a webinar, what other actions did those 5 people do? How else did they engage with us?
Does that make sense?
12-06-2018 08:17 AM
the measure always gives different values dependng on filter context coming from visuals, report/page/visual filters etc. and how visual is structured
for your example you can use [NrOfEngagements] together with Customer Name in the visual and only use [NrOfRegistrations]<>0 in the filter of that visual
I'd suggest just trying these measures in different layouts, once you have more clear idea how you want to present the data and what to calculate we can adjust the measures
e.g. you can create measure using CONCATENATEX that would return a string of all actions for the users that have nrofregistrations>0, which is possible but is quite unusal way of presenting data
right now I'm not clear what you want to present and in which format
12-06-2018 08:35 AM
or in case the actions is supposed to be dynamic it is even more dependant on the visual setup:
1) how do users pick up the action to be referenced (slicer?) Can there be multiple actions selected or only one at a time? if there are more should the which operator should be used (AND/OR?)
2) do you want to show nuber of categorised number of other actions, or action names? if action names how do you want to aggregate multiple actions for a single customer?