Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

Simple measure

Hi,

 

I want a measure that gives me the count of Client ID that have made a transaction in the last 3 months. My table looks like this:

 

Client IDOperationDate
1Last transaction8/30/2019
2Opening8/30/2019
3Closure8/30/2019
4Last transaction8/30/2019
5Opening8/29/2019
6Closure8/28/2019
7Last transaction8/5/2019
8Last transaction8/24/2019
9Last transaction8/24/2019

 

The measure should count distinct Client ID, filter Operation in {"Last Transacion"} and then filter all the dates from today until 3 months ago.

 

 

Thanks in advance,

 

IC

1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI @Anonymous ,

I'd like to suggest you to use date and today functions to looping records and get last three month distinct count based on current date:

Measure =
CALCULATE (
    COUNTROWS ( VALUES ( Table[Client ID] ) ),
    FILTER (
        ALLSELECTED ( Table ),
        [Operation] = "Last transaction"
            && [Date]
                >= DATE ( YEAR ( TODAY () ), MONTH ( TODAY () ) - 3, DAY ( TODAY () ) )
            && [Date] <= TODAY ()
    )
)

Regards,

Xiaoxin Sheng

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

HI @Anonymous ,

I'd like to suggest you to use date and today functions to looping records and get last three month distinct count based on current date:

Measure =
CALCULATE (
    COUNTROWS ( VALUES ( Table[Client ID] ) ),
    FILTER (
        ALLSELECTED ( Table ),
        [Operation] = "Last transaction"
            && [Date]
                >= DATE ( YEAR ( TODAY () ), MONTH ( TODAY () ) - 3, DAY ( TODAY () ) )
            && [Date] <= TODAY ()
    )
)

Regards,

Xiaoxin Sheng

Ashish_Mathur
Super User
Super User

Hi,

Create a Calendar Table and build a relationship from the Date column of the Data Table to the Date column of the Calendar Table.  Try this measure

Measure = COUNTROWS(FILTER(SUMMARIZE(CALCULATETABLE(Values(Data[Client ID]),Data[Operation]="Last Transaction"),[Client ID],"ABCD",CALCULATE(DISTINCTCOUNT(Data[Client ID]),DATESBETWEEN(Calendar[Date],EDATE(TODAY(),-2),TODAY())),[ABCD]>0))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors