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

Shape the future of the Fabric Community! Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions. Take survey.

Reply
TadeAde2020
New Member

Count Multiple conditions: DAX

Hi, this my first post in this forum. I have been searching for a solution all day but no luck. Below is my question

- On a table I have a column called 'sector' that categorises customers to the sectors they work in (eg banking, Financial services....)

- The second column called 'Payment made', indicates whether the customer has made payment ('Yes' if they have and 'No' if they have not)

 

Question: I want to count for the condition the amount of people that have made payments in each sector, and ultimately plot this measure on the graph.

 

I already have a graph that generally displays the number of customers in each sector whether they have paid or not. I would like to combine the filtered graph from the new measure above, so that I can compare the total customers in each sector vs. the customers that have paid in this sector.

 

Please I would really appreciate a solution to this. Thank you 

 
3 REPLIES 3
Hube
Frequent Visitor

 Hola de nuevo.. todo bien pero ahora quiero añadir una tarjeta en la que me sume el total de las visitas que son 0 y no consigo hacerlo.

¿cómo poner en una tarjeta la suma de clientes no visitados o que el valor de la medida es 0?

Grácias de nuevo

amitchandak
Super User
Super User

@TadeAde2020 , There a few ways. You can use slicers and visual or page level filter

 

You can use the filter in calculate of X functions

In calculate

Calculate(count(A[B]), A[payment]="Yes", filter2, filter3)

All these filter are and

Calculate(count(A[B]), filter(A, A[payment]="Yes" && A[Mode] = "ABC")

 

Here you can use && (and) || (Or), the tables should be joined which you are using

 

If they are not joined, refer

https://docs.microsoft.com/en-us/dax/treatas-function

 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
edhans
Super User
Super User

A table/sample data would be helpful. But the below pseudo code would be how I would approach it with the limited knowledge of what you have:

Total Count =
COUNTX(
    FILTER(
        Sometable,
        sometable[field1] = "this"
            && sometable[field2] = "that"
    ),
    sometable[field1]
)

 

&& does AND. You can just keep adding other conditions. 

Change it to || if you want it to be an OR comparison.

 

How to get good help fast. Help us help you.
How to Get Your Question Answered Quickly
How to provide sample data in the Power BI Forum



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.