cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

#### Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors
Top Kudoed Authors