06-24-2016 06:54 AM
Looking for advice on how to calculate year on year variance using COUNT. Please can someone tell me how to do this?
I want to count the number of Customer ID's by year and show the +/- difference for each year.
I've tried the following formula which results in the waterfall below:
CALCULATE(COUNT('Customer'[Customer ID Number]))-PREVIOUSYEAR('Year'[Entry Year V2])
Can someone explain to me how I get this waterfall to show the difference rather than the count for each year?
06-27-2016 04:37 AM
In your scenario, you need to create a calculated column which will return difference values between years. Then place the column field in waterfall chart Y Axis property. Please refer to the sample below:
DatePrevious = CALCULATE(MAX(Table1[Date]), (FILTER(Table1, EARLIER(Table1[Team ID])=Table1[Team ID] && EARLIER(Table1[Date])>Table1[Date])))
ValuePrevious = CALCULATE(SUM(Table1[Sales]), (FILTER(Table1, EARLIER(Table1[Team ID])=Table1[Team ID] && EARLIER(Table1[DatePrevious])=Table1[Date])))
Change in sales = if(Table1[ValuePrevious]=0, 0, Table1[Sales]-Table1[ValuePrevious])
If you have any question, please feel free to ask.
06-28-2016 02:14 AM
Hi Qiuyun Yu,
Thanks for getting back to me on this. I have tried applying the logic in your reply however I am still struggling to get this to work.
Each row in my data relates to an individual customer finace application and contains information about the customer and their application. One of the fields is the 'year of application'. This value is only a year value between 2011-2015. Each customer and therefore ID can appear multiple times each year dependent on how many finace applications they have submitted to the company. I therefore want to count how many total customer applications were made each year and then show the actual +/- change in the count of applications . I have mocked up some data below as an example of what im looking for. Ideally the chart should change when I use a slicer to select type of application or another value in the actual data.
|Customer ID||Year of Application||Type of Application|
What the waterfall should show:
Apologies if there is a really simple solution to this however I am just beginning to get to grips with Power Bi. I hope this makes sense and thank you for any further help you can offer.
06-29-2016 02:15 AM
In your scenario, you can create a new table via expression:
Table = SUMMARIZE('RAW',RAW[Year of Application],"Count",COUNTA(RAW[Type of Application]))
Then create two calculated columns:
CountPrevious = calculate(SUM('Table'[Count]),filter('Table','Table'[Year of Application]=EARLIER('Table'[Year of Application])-1))
Difference = if('Table'[CountPrevious]=0, BLANK(), 'Table'[Count]-'Table'[CountPrevious])
For details, you can download the attached .PBIX file.
05-30-2017 06:52 PM