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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
vengadesh_p
Helper I
Helper I

Need to count no of active customers based on latest date status

Hi All, 

I'm new to PowerBI, Please help me achive below logic

 

I have two table in my datamodel (Active Customer Table & Master Calendar Table)

 

I have Data like below Table

 

Active Customer Table

test1.png

 

I want to create a DAX query for, where we will be able to see the latest Active status of all consumers  for any date user will chose (date, week, month, quarter, year) . and also important that we see accumulative summary from all time before until the chosen date.

Expected Output 
test.png

 

Data

CustomerIDDateActive status
A1/1/20201
B1/1/20201
C1/1/20201
D2/1/20201
A3/1/20200
B3/1/20200
B3/2/20201
B3/3/20200
E3/4/20201
D4/1/20200
A4/1/20201
B4/2/20201

 

 


Thanks,

Vengadesh P

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@vengadesh_p ,  Try a measure like

Measure =

Countx(filter(allselected(Table, Table[CustomerID]= max(Table[CustomerID]) && Table[Date]<= max(Table[Date]) && Table[Active status] =1),[CustomerID])

-

Countx(filter(allselected(Table, Table[CustomerID]= max(Table[CustomerID]) && Table[Date]<= max(Table[Date]) && Table[Active status] =0),[CustomerID])

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

vengadesh_p
Helper I
Helper I

@amitchandak 

i have modified your Query. its working fine. Thank you... 

 

Active Customer = 
COUNTX (
    FILTER (
        ALLSELECTED ( 'Table' ),
        'Table'[Date] <= MAX ( 'Table'[Date] ) &&
        'Table'[Active status] = 1
    ),
    'Table'[CustomerID]
)
-
COUNTX (
    FILTER (
        ALLSELECTED ( 'Table' ),
        'Table'[Date] <= MAX ( 'Table'[Date] ) &&
        'Table'[Active status] = 0
    ),
    'Table'[CustomerID]
)

 

View solution in original post

3 REPLIES 3
vengadesh_p
Helper I
Helper I

@amitchandak 

i have modified your Query. its working fine. Thank you... 

 

Active Customer = 
COUNTX (
    FILTER (
        ALLSELECTED ( 'Table' ),
        'Table'[Date] <= MAX ( 'Table'[Date] ) &&
        'Table'[Active status] = 1
    ),
    'Table'[CustomerID]
)
-
COUNTX (
    FILTER (
        ALLSELECTED ( 'Table' ),
        'Table'[Date] <= MAX ( 'Table'[Date] ) &&
        'Table'[Active status] = 0
    ),
    'Table'[CustomerID]
)

 

amitchandak
Super User
Super User

@vengadesh_p ,  Try a measure like

Measure =

Countx(filter(allselected(Table, Table[CustomerID]= max(Table[CustomerID]) && Table[Date]<= max(Table[Date]) && Table[Active status] =1),[CustomerID])

-

Countx(filter(allselected(Table, Table[CustomerID]= max(Table[CustomerID]) && Table[Date]<= max(Table[Date]) && Table[Active status] =0),[CustomerID])

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak  it's show some syntex error. can you please share pbix file 
 

Screenshot_2.png

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors