The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi all,
I have a scenario where i want to sum the Amounts for customers based on when they did a transaction. I've successfully calulated this using the following measure
Sum_LastTransactions =
CustomerID | TransactionDate | Amount |
AA11 | 1/01/2022 | 30 |
AA11 | 1/02/2022 | 40 |
AB01 | 1/02/2022 | 20 |
AC00 | 1/01/2022 | 10 |
AD01 | 1/03/2022 | 50 |
AA11 | 2/03/2022 | 100 |
AB01 | 2/03/2022 | 200 |
AC00 | 1/01/2022 | 10 |
Solved! Go to Solution.
Simple enough
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! |
Simple enough
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! |
Hi @Anonymous
One way to do that
Sum_LastTransactions1 =
VAR MaxDate =
MAXX (
CALCULATETABLE (
'Data',
ALLEXCEPT ( 'Data', 'Data'[CustomerID] )
),
'Data'[TransactionDate]
)
RETURN
MAXX (
FILTER ( 'Data', 'Data'[TransactionDate] = MaxDate ),
Data[Amount]
)
User | Count |
---|---|
27 | |
12 | |
8 | |
8 | |
5 |
User | Count |
---|---|
31 | |
15 | |
12 | |
7 | |
6 |