Quantcast
Channel: Desktop topics
Viewing all articles
Browse latest Browse all 213819

Expanding Summary Table

$
0
0

With some help on a previous topic I was able to create a daily summary table with the formula: (I hope the formatting is ok, still new to DAX - feel free to comment if it's off)

DailySummaryTable = 
	ADDCOLUMNS(
		SUMMARIZE(
			Broker,
			Broker[LeadDate]
		),
		"Leads", COUNTX(
			FILTER(
				Broker,
				Broker[LeadDate]=EARLIER(Broker[LeadDate])  
			),
			Broker[LeadDate]
		),
		"Sales", COUNTX(
			FILTER(
				Broker,
				Broker[SaleDate]=EARLIER(Broker[LeadDate]) 
			),
			Broker[SaleDate]
		)
)


This gives me a great daily summary, however how would I set about including some other columns from my main table?
For example, what if I want to see a breakdown of [category1] per day. How do I introduce this without breaking the daily counts?
 
So my current table output is

Origin Date | Status 1 Count | Status 2 Count | etc
date1 | 10 | 20
date2 | 5| 30
etc
 
My desired output is:
Origin Date | Category | Status 1 Count | Status 2 Count
date1 | category1 | 5 | 15
date1 | category2 | 5 | 5
date2 | category1 | 1 | 10
date2 | category2 | 2 | 10
date2 | category3 | 3 | 10

My problem is that if I simply add another column to my SUMMARIZE statement then it assigns the daily value to each item in that new column. And if I add an additional filter to my COUNTX statement the numbers don't quite add up. My attempted code that doesn't work correct is:

DailySummaryTable = 
	ADDCOLUMNS(
		SUMMARIZE(
			Broker,
			Broker[LeadDate],
                        Broker[category1]
		),
		"Leads", COUNTX(
			FILTER(
				Broker,
				Broker[LeadDate]=EARLIER(Broker[LeadDate]),
                                Broker[category1]=EARLIER(Broker[category1]) 
			),
			Broker[LeadDate]
		)
         )


 
Your help is much appreciated.
 
Regards
Cobus
 


Viewing all articles
Browse latest Browse all 213819

Trending Articles