March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Below is my table, TR.
Date | Account | Type | Balance |
2023/1/10 | A | Transfer | 10 |
2023/5/18 | A | Save | 20 |
2023/5/19 | A | Interest | 30 |
2023/5/30 | A | Payment | 10 |
2023/2/7 | B | Transfer | 50 |
2023/3/8 | B | Save | 80 |
2023/3/19 | B | Save | 100 |
2023/4/16 | B | Payment | 20 |
2023/4/30 | B | Interest | 30 |
I want to filter the table by three rules.
1. The dates in the table must have a maximum of 15 days difference from 5/31.
2. Filter the type which doesn't equal "Interest" and "Payment".
3. Show the table with distinct accounts with a max date.
Date | Account | Type | Balance | Datediff |
2023/5/18 | A | Save | 20 | 13 |
Below is my Dax. ( I make a measure in the Power BI dashboard.) But it always can't work. I want to count the account. (Show the value by a card)
Solved! Go to Solution.
Hi @Karen1015 ,
You can create a new measure using the DAX below
NewTR =
VAR noofaccount =
SUMMARIZE (
FILTER (
TR,
DATEDIFF ( TR[Date ], DATE ( 2023, 5, 31 ), DAY ) < 15
&& NOT ( TR[Type] ) IN { "Interest", "Payment" }
),
TR[Date ],
TR[Account ],
TR[Type],
TR[ Balance]
)
RETURN
COUNTROWS(noofaccount)
You can also create a new table that is what you are looking for using the below DAX whose output looks like shown below
Hi @Karen1015 ,
You can create a new measure using the DAX below
NewTR =
VAR noofaccount =
SUMMARIZE (
FILTER (
TR,
DATEDIFF ( TR[Date ], DATE ( 2023, 5, 31 ), DAY ) < 15
&& NOT ( TR[Type] ) IN { "Interest", "Payment" }
),
TR[Date ],
TR[Account ],
TR[Type],
TR[ Balance]
)
RETURN
COUNTROWS(noofaccount)
You can also create a new table that is what you are looking for using the below DAX whose output looks like shown below
HI ,try below measure:
In this measure, we first filter the 'TR' table based on the given conditions: Type is not "Interest" or "Payment" and the date difference is less than or equal to 15. We then use the SUMMARIZE function to group the filtered data by 'Account' and calculate the maximum date for each account.
Next, we calculate the date difference using the 'MaxDate' and the specified date using the DATEDIFF function. Finally, we count the number of distinct accounts from the resulting table, which gives us the desired count.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
125 | |
85 | |
69 | |
54 | |
45 |
User | Count |
---|---|
204 | |
106 | |
98 | |
65 | |
54 |