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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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] )

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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