Forum Discussion
Different Statistics Based on Various Date Fields
- 8 years ago
Hi Anonymous,
I made one sample for your reference. You can refer to the following steps.
1. Create the relationship between tables like this.
2. Create the measures as below.
Createcount = CALCULATE(COUNTROWS(Trans),USERELATIONSHIP('Date'[Date],Trans[ProdOrderCreateDate]))finishcount = CALCULATE(COUNTROWS(Trans),USERELATIONSHIP('Date'[Date],Trans[ProdOrderFinishDate]))Transcount = CALCULATE(COUNTROWS(Trans))
For more details, please check the pbix as attached.
Regards,
Frank
Hi Anonymous,
I made one sample for your reference. You can refer to the following steps.
1. Create the relationship between tables like this.
2. Create the measures as below.
Createcount = CALCULATE(COUNTROWS(Trans),USERELATIONSHIP('Date'[Date],Trans[ProdOrderCreateDate]))finishcount = CALCULATE(COUNTROWS(Trans),USERELATIONSHIP('Date'[Date],Trans[ProdOrderFinishDate]))Transcount = CALCULATE(COUNTROWS(Trans))
For more details, please check the pbix as attached.
Regards,
Frank
- Anonymous8 years agoNot applicable
Hey v-frfei-msft,
Thank you! That worked just fine, nice and easy. I did make a small tweak to your code to get it closer to my requirements. A quick test using a matrix and a visual work great.
Another question though, how can I create another table that will show only records from a selected cell that uses the new CreatedCount measure to display only relevant records. Below is a matrix screenshot based on the new measure. Usually, this kind of contectual filtering works fine with active relationships.
Also, can I create date filters (ex. CreatedDate filter) that use inactive relationship between the two tables?
CreatedCount = CALCULATE(DISTINCTCOUNT(Trans[ProdOrderId]),USERELATIONSHIP('Date'[Date],Trans[ProdOrderCreateDate]))