Forum Discussion
abhishekc1
7 years agoFrequent Visitor
Total orders by category
Hi All, Need your help with the following: My data looks like this- I have a data table that has the following fields: Order IDCustomer idDateAmountProduct NameLocation OD 1 cl 1 1/1/2019 ...
- 7 years ago
Hi abhishekc1 ,
One sample for your reference, please check the following steps as below.
1. Create a calculated column in order table.
Yearmonth = YEAR('Order'[Date]) *100 + MONTH('Order'[Date])2. To create another calculated column to get the excepted result.
result = VAR coun = CALCULATE ( COUNT ( 'Order'[Customer id] ), FILTER ( 'Order', 'Order'[Customer id] = EARLIER ( 'Order'[Customer id] ) && 'Order'[Yearmonth] = EARLIER ( 'Order'[Yearmonth] ) ) ) RETURN IF ( coun < 4, "ordered 1-3 ", "ordered more that 4" )pbix as attached.
v-frfei-msft
7 years agoCommunity Support
Hi abhishekc1 ,
One sample for your reference, please check the following steps as below.
1. Create a calculated column in order table.
Yearmonth = YEAR('Order'[Date]) *100 + MONTH('Order'[Date])
2. To create another calculated column to get the excepted result.
result =
VAR coun =
CALCULATE (
COUNT ( 'Order'[Customer id] ),
FILTER (
'Order',
'Order'[Customer id] = EARLIER ( 'Order'[Customer id] )
&& 'Order'[Yearmonth] = EARLIER ( 'Order'[Yearmonth] )
)
)
RETURN
IF ( coun < 4, "ordered 1-3 ", "ordered more that 4" )
pbix as attached.
abhishekc1
7 years agoFrequent Visitor
You’re a rockstar. Thank you so much and I’m terribly sorry I couldn’t reply earlier. Your solution worked like a charm.