cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Regular Visitor

Count a measure results (Text)

Hello folks,

I am struggling with what I thought should be simple. I m ranking the clients as per the below :

The problem is I want to count the the number of clients by theire status.

The Dax are as the below:

active sales = if([year of sales] >0 ,1 , "")
Active sales PY = IF([year of sales PY]>0,1,"")
Client status = if([active sales]=1,if([Active sales PY]="","New","Existing"),if([Active sales PY]=1,"lost","Non-active"))

Now the [year of sales] is a bit complicated but I ll share it anyway:

year of sales = if([Quater No.]=1,[Sales PQ]-[Sales PY (Aging)]+ sum('Client Aging'[Sales Turnover]),if([Quater No.]=2,calculate([Sales PQ],PREVIOUSQUARTER('Calendar'[date])) - [Sales PY (Aging)] + sum('Client Aging'[Sales Turnover]),if([Quater No.]=3,CALCULATE(CALCULATE([Sales PQ],PREVIOUSQUARTER('Calendar'[date])),PREVIOUSQUARTER('Calendar'[date])) - [Sales PY (Aging)]+ sum('Client Aging'[Sales Turnover]),if([Quater No.]=4,sum('Client Aging'[Sales Turnover]),0))))

Any ideas about how can I count the clients by their status?

Thank you.

1 ACCEPTED SOLUTION
Super User

Hi @Baroumy
Manually insert a single column disconnect table that contains all statuses (unique list of statuses). Place the new column in a table visual along with the following measure.

``````Count =
SUMX (
CROSSJOIN ( VALUES ( 'Table'[Code] ), VALUES ( Status[Status] ) ),
INT ( [Client Status] = Status[Status] )
)``````
6 REPLIES 6
Super User

Hi @Baroumy
Manually insert a single column disconnect table that contains all statuses (unique list of statuses). Place the new column in a table visual along with the following measure.

``````Count =
SUMX (
CROSSJOIN ( VALUES ( 'Table'[Code] ), VALUES ( Status[Status] ) ),
INT ( [Client Status] = Status[Status] )
)``````
Regular Visitor

Hi @tamerj1

So I should do the first step in the query editor by clicking the "enter data" button and creating a new table named list of status and manually entering the 4 statuses?

PS: I need to use the total counts in a single card visual.

Super User

@Baroumy
- Yes
- Yes it should work

Regular Visitor

Thanks al lot.

However the total are wrong, I believe it is due to the [year of sales] and [year of sales PY] measures and the dates filter.

Below are the results :

The existing count is 0! it shoudl be 288.

Super User

@Baroumy
Try to select a year in a slicer to see what happens. Also I did not understand what is the problem with the total?

*EDIT

Check the spelling of Existing and make sure it matches 100%. It could be a space.

Regular Visitor

Thank you @tamerj1 .

The problem was I am relying on the client codes coming from each year's transactions. I added a client list table and I guess the problem is solved.

thank you.

Announcements

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Monthly Update - August 2024

Check out the August 2024 Power BI update to learn about new features.

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Fabric Community Update - September 2024

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

Top Solution Authors
Top Kudoed Authors