Forum Discussion
Distinct count based on the sum and month
- 6 years ago
Anonymous , Try like
countx(filter(summarize(Table, Table[Vehicle Number], "_1",
CALCULATE(sum(Table[Km Driven]),DATESINPERIOD(Master_Data[Month ],MAX(Master_Data[Month ]),-3,MONTH))),[_1]<10),[Vehicle Number])I am hosting a webinar on 25th April on Power BI, Check Details - https://www.linkedin.com/posts/amitchandak78_webinar-tech-techforgood-activity-6658266754378231808-ye5L
Hi Anonymous ,
We can create a measure to meet your requirement.
Measure =
VAR selected_month =
DATE ( YEAR ( MAX('Table'[Date]) ), MONTH ( MAX('Table'[Date]) ) - 3, DAY ( MAX('Table'[Date]) ) )
RETURN
CALCULATE (
DISTINCTCOUNT ( 'Table'[Vehicle] ),
'Table'[Date] >= selected_month,
FILTER (
SUMMARIZE (
'Table',
'Table'[Vehicle],
"test", CALCULATE ( SUM ( 'Table'[Km Driven] ) )
),
[test] < 10
)
)
Then we can use a card visual and a line chart visual to show the result.
If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?
BTW, pbix as attached.
Best regards,
Community Support Team _ zhenbw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.