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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare 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
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

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

October NL Carousel

Fabric Community Update - October 2024

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