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
darin_ramsey
New Member

How to get total uses of dozens of document codes?

I have several years' worth of data like the image below. I need to count the total uses of the alphabetic codes in the second column, like ENG, RALB, and SQP. I tried this measure:

CodeCount = DISTINCTCOUNT('Done Data Files'[Group])

It gives me "48", which is the number of such codes in the 2019 data. ("Group" is a column not shown in the image that keeps only the content to the left of the hyphen.)

 

I need numbers like ENG = 23. I can find that number by filtering and counting, but I'm stumped on getting it in a column or measure using DAX. 

data_csv-sample.jpg

I'm very new to PowerBI; I've finished an excellent course online, but figuring out how to parse the data I need is a steep climb.

2 REPLIES 2
darin_ramsey
New Member

Thanks, Ahmedx! I have the column shown below in the data view, as column "Group."

The DAX for that column is as follows:

Group = IF('Done Data Files'[Forms]="Form",(LEFT('Done Data Files'[DocNo],SEARCH("-",'Done Data Files'[DocNo],,LEN('Done Data Files'[DocNo])+1)-1)),"Non-Form")

My attempts at using COUNT to get the totals of each result in the Group column have failed. Is this something I can only get in visualizations? I was also thinking a separate data table might work to give me this count.

GroupColumnIncluded.jpg

 

 

Ahmedx
Super User
Super User

you need to create an additional column like this, and then it will be easier for you to calculate the COUNT
Screen Capture #1106.png

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.