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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Jonathan47
Helper I
Helper I

Countax problem

Hi there,

 

I have a column called "Error Number" in a table called "Errors" and I have a column in my data table called "values". I'd like to count the amount of times a value in my "values" column matches up with an error number from my column " Error Number", i.e. how many instances error number 104 appears in the "values" column and so on for each error number listed.

 

I've tried using countax but it returns the same value in each row instead of what is shown in the table below. The dax code i used was: Count = COUNTAX(FILTER('Data', Data[Attribute] = "Error Number []"), 'Data'[Value] = ('Errors'[Error Number]))

-I had to filter my values column using the atribute column since I unpivotted the columns.
Does anyone have any ideas as to how I can go about this? TIA

 

Error NumberCount
1041
2040
2050
4040
4050
50230
5032
80250
803200
13040
14170
34030
350115
3502300
351147
35172
35195
35210
35220
360122
380335
400353
60020
6013103
2 REPLIES 2
amitchandak
Super User
Super User

@Jonathan47 , This will give the same value

COUNTAX(FILTER('Data', Data[Attribute] = "Error Number []"), 'Data'[Value] = ('Errors'[Error Number]))

 

Unless you add something like in the filter

Data[Attribute] = earlier(Data[Attribute] )

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

Hi @amitchandak, I'm not too sure how this would solve my problem. I need to first filter my values column using my attributes column since there are multiple attributes in my values column. Changing the code to COUNTAX(FILTER('Data', earlier(Data[Attribute]) = "Error Number []"), 'Data'[Value] = ('Errors'[Error Number])) gives me an error (I guess I've put it in the wrong place)

 

https://drive.google.com/drive/u/0/folders/1M2HlRKgtvPcsyK-VWwYmkWu5ZHCYRuHN

Here is a link to a sample data set I created. Theres no need to filter attributes in this example. I just need to count the values column for each error number (evaluated for each row). If you/someone could give me an example of how I can do this that would be very helpful. TIA

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 MSCUST for a $150 discount!

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.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.