cancel
Showing results for
Did you mean:

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Helper V

## count customers with digital transaction ratio bigger than in a date period

i have this table

 customer date transaction type amount 1 1/1/2022 digital 10 1 1/2/2022 digital 20 1 1/3/2022 digital 30 1 1/4/2022 digital 11 1 1/5/2022 digital 48 1 1/6/2022 digital 69 1 1/1/2022 physical 45 1 1/2/2022 physical 85 1 1/3/2022 physical 96 1 1/4/2022 physical 47 1 1/5/2022 physical 6 1 1/6/2022 physical 22 2 1/1/2022 digital 10 2 1/2/2022 digital 20 2 1/3/2022 digital 30 2 1/4/2022 digital 11 2 1/5/2022 digital 48 2 1/6/2022 digital 69 2 1/1/2022 physical 45 2 1/2/2022 physical 85 2 1/3/2022 physical 96 2 1/4/2022 physical 47 2 1/5/2022 physical 6 2 1/6/2022 physical 22 2 1/1/2022 digital 10 2 1/2/2022 digital 20 2 1/3/2022 digital 30 2 1/4/2022 digital 11 2 1/5/2022 digital 48 2 1/6/2022 digital 69 2 1/1/2022 physical 45 2 1/2/2022 physical 85 2 1/3/2022 physical 96 2 1/4/2022 physical 47 2 1/5/2022 physical 6 2 1/6/2022 physical 22

for each customer i want to calculate the ratio digital / total transactions (digital+physical) amount in the last 3 months

a customers that has ratio >0.5 (digital transactions more than 50% of his total transactions is a digital customer

I want when selecting a month form a slicer (example 01/06/2022) to count the customers of this month that have a >0.5 in the last 3 months of this selection.

2 ACCEPTED SOLUTIONS
Community Champion

 Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! DAX is simple, but NOT EASY!
Community Champion
``````=
COUNTROWS(
FILTER(
VALUES( TXN[customer] ),
CALCULATE(
CALCULATE( [Total], TXN[transaction type] = "digital" ) / [Total],
DATESINPERIOD( DATES[Date], MAX( DATES[Date] ), -3, MONTH )
) > .5
)
)``````

 Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! DAX is simple, but NOT EASY!
6 REPLIES 6
Helper V

can the dax be modified so it shows in a card the distinct count of customers for this? (>0.5)?

Community Champion

To obtain the same visual effect as Card,

 Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! DAX is simple, but NOT EASY!
Helper V

I would like to count the customers. Example 4 customers in this month had digital ratio (3 month  transactions) >0.5

Community Champion
``````=
COUNTROWS(
FILTER(
VALUES( TXN[customer] ),
CALCULATE(
CALCULATE( [Total], TXN[transaction type] = "digital" ) / [Total],
DATESINPERIOD( DATES[Date], MAX( DATES[Date] ), -3, MONTH )
) > .5
)
)``````

 Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! DAX is simple, but NOT EASY!
Helper V

Thanks worked great!

Community Champion

 Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! DAX is simple, but NOT EASY!

Announcements

#### New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

#### Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

#### Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors