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
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]))
Error Number | Count |
104 | 1 |
204 | 0 |
205 | 0 |
404 | 0 |
405 | 0 |
502 | 30 |
503 | 2 |
802 | 50 |
803 | 200 |
1304 | 0 |
1417 | 0 |
3403 | 0 |
3501 | 15 |
3502 | 300 |
3511 | 47 |
3517 | 2 |
3519 | 5 |
3521 | 0 |
3522 | 0 |
3601 | 22 |
3803 | 35 |
4003 | 53 |
6002 | 0 |
6013 | 103 |
@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
Check out the October 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
110 | |
96 | |
90 | |
81 | |
69 |
User | Count |
---|---|
157 | |
125 | |
116 | |
111 | |
95 |