luuminhvuong93
New Member
- Joined
- Apr 9, 2017
- Messages
- 1
[FONT="]Hi all,[/FONT]
[FONT="]I have a situation like in the photo, a simplified data in the excel attached.[/FONT]
[FONT="]2 tables: Fact and Plan.[/FONT]
[FONT="]*Fact: showing how much Volume was sold to a customer, by each Saleman. The period in example is Month 1 and 2 , but actually this is from 2015-2016 (24 months).[/FONT]
[FONT="]Note that 1 customer can buy from multiple Salemen.[/FONT]
[FONT="]*Plan: showing which Customer is being assigned to call by which Saleman (SM). This is the current assignment (2017).[/FONT]
[FONT="]Note that 1 Customer can be assigned to multiple Salemen.[/FONT]
[FONT="]Some customer in the fact table (i.e. E, G, H no longer exists)[/FONT]
[FONT="] [/FONT]
[FONT="]Question: How to Calculate the: Number of Month (after a certain month, for example here is January) that a customer have volume >0?[/FONT]
[FONT="](has to be a Calculated Column)[/FONT]
[FONT="] [/FONT]
[FONT="]I tried the below formula - it works fine in the example simplified data, but it takes forever to calculate in my actual data (+1,000,000 rows) and froze my laptop. I am new , so I don't know what could be a better way to achieve this result. [/FONT]
[FONT="] [/FONT]
=CALCULATE(DISTINCTCOUNT('Fact'[Month]),'Fact'[Cus<wbr style="box-sizing: inherit;">tomer]=EARLIER(Plan[Customer]),'Fact'[Volume]>0,'F<wbr style="box-sizing: inherit;">act'[Month]>1)[FONT="] [/FONT]
[FONT="] [/FONT]
[FONT="] [/FONT]
[FONT="]
[/FONT]
[FONT="] [/FONT]
[FONT="]Below is the example data - simplified:[/FONT]
[FONT="]https://drive.google.com/file/d/0B7l_L5iVxXj-WE1Re<wbr style="box-sizing: inherit;">m9SQk9VLTQ/view?usp=sharing[/FONT]
[FONT="] [/FONT]
[FONT="]I have a situation like in the photo, a simplified data in the excel attached.[/FONT]
[FONT="]2 tables: Fact and Plan.[/FONT]
[FONT="]*Fact: showing how much Volume was sold to a customer, by each Saleman. The period in example is Month 1 and 2 , but actually this is from 2015-2016 (24 months).[/FONT]
[FONT="]Note that 1 customer can buy from multiple Salemen.[/FONT]
[FONT="]*Plan: showing which Customer is being assigned to call by which Saleman (SM). This is the current assignment (2017).[/FONT]
[FONT="]Note that 1 Customer can be assigned to multiple Salemen.[/FONT]
[FONT="]Some customer in the fact table (i.e. E, G, H no longer exists)[/FONT]
[FONT="] [/FONT]
[FONT="]Question: How to Calculate the: Number of Month (after a certain month, for example here is January) that a customer have volume >0?[/FONT]
[FONT="](has to be a Calculated Column)[/FONT]
[FONT="] [/FONT]
[FONT="]I tried the below formula - it works fine in the example simplified data, but it takes forever to calculate in my actual data (+1,000,000 rows) and froze my laptop. I am new , so I don't know what could be a better way to achieve this result. [/FONT]
[FONT="] [/FONT]
=CALCULATE(DISTINCTCOUNT('Fact'[Month]),'Fact'[Cus<wbr style="box-sizing: inherit;">tomer]=EARLIER(Plan[Customer]),'Fact'[Volume]>0,'F<wbr style="box-sizing: inherit;">act'[Month]>1)[FONT="] [/FONT]
[FONT="] [/FONT]
[FONT="] [/FONT]
[FONT="]
[FONT="] [/FONT]
[FONT="]Below is the example data - simplified:[/FONT]
[FONT="]https://drive.google.com/file/d/0B7l_L5iVxXj-WE1Re<wbr style="box-sizing: inherit;">m9SQk9VLTQ/view?usp=sharing[/FONT]
[FONT="] [/FONT]