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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.

Reply
Anonymous
Not applicable

DAX - Count by group

Hi All,

In my report, there is a Slicer of "Shop"

I am trying to write a DAX to count how many customers with these critirias:

 

1.) The customers's first transaction is from the Shop Slicer (Assuming "A") --> 2 cutomers 

2.) Later on, those customers have transaction in Shop B --> 1 customer

IDTransaction DateShop
1Jan 1 2022A
1Feb 1 2022B
1May 1 2022C
2Jan 1 2022A
2Feb 1 2022C
3Jan 1 2022B
3Feb 1 2022A

 

May I ask how it is possible to get the answer "1" by using DAX or calculated column?

2 REPLIES 2
Anonymous
Not applicable

Hi  @Anonymous ,

Here are the steps you can follow:

1. Create measure.

Measure =
var _select=SELECTEDVALUE('Table'[Shop])
return
COUNTX(FILTER(ALL('Table'),
'Table'[ID]<=2 && 'Table'[Shop]=_select),[Shop])

2. Result:

vyangliumsft_0-1663290757945.png

 

vyangliumsft_1-1663290757949.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Anonymous
Not applicable

@Anonymous thanks but sorry that I am not so clear.

 

I am hoping to count the customer who 

1.) first transaction in shop A (which is depended on the slicer)

2.) for those whose first transaction in shop A, how many of them later on, have transaction in shop B (Shop B is required)

 

Thanks in advance

Helpful resources

Announcements
May PBI 25 Carousel

Power BI Monthly Update - May 2025

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

May 2025 Monthly Update

Fabric Community Update - May 2025

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