Count dax code. rows have text and numbers

Hello. Paul here again. I am trying to count number of work orders. But the column in the data has both numbers and text. So when I do COUNTROWS or COUNT, my value is lower than the raw data. It’s context is by Region. Help.

Total Number of SROs = COUNTROWS( 'AMSS Detail ') + 0

image

Hi @Paul.Gerber. Sounds like something simple, but can you upload a PBIX for the forum members to review?
Greg

I would but it’s confidential financials for the company I work for.

Hi @Greg is there another way?

I know it’s probably straightforward. I’m just having a brain fart.

Create sample data that illustrates your issue and upload?

1 Like

That might take some time. It’s a 10mb file. I’ll see if I can find a older version

Got it … took a quick look, and none of the visuals look like your question. Can you screen-shot the visual in question and note what number you’re getting and mark-up with what you expect?
Greg
(going offline for the work day and the summit … I’ll try to get back to it later tonight or tomorrow morning)

Hi @Paul.Gerber. OK, another round. Got your new file, cannot match it with the screenshot provided in your first post introducing the issue. Please take a screenshot of the current state with all desired filters set appropriately, and markup the screenshot with what you expect to see. Your DAX code for [Total Number of SROs] differs as well.

Total Number of SROs = DISTINCTCOUNT('AMSS Detail'[sCOSRONum])+0

With these, perhaps we can identify the issue.
Greg

Hello sir. Thanks for looking. I have it opened now and included screenshots. What I’m doing is going to the data and filtering just for the Permian region, year is 2022, month is January. Under sCOSRONum for the data it displays 440 rows. Each SRO is designated to a particular product line. So when I have a measure to count the total number of rows, in my mind it should return 440 SROs. Not 142 as shown in the second picture. why the difference? Do I need to add a filter for all product line items? what is it counting. Many thanks

Paul


OK, looked again … can’t match your numbers. When I filter as you suggest for 2021 and January and Permian, I get 664, not 142. We’re missing something here. Perhaps repeat the screenshot circle the number of interest, and what you expect to get, and attach the specific file from which the screenshot(s) were taken.
Greg

Try January 2022

@Greg

CALCULATE( COUNTA ( ‘AMSS Detail’[sCOSRONum]), DISTINCT( ‘AMSS Detail’[Product Line]))

fixed

@Greg Thanks so much for looking into this and spending time. I was reviewing one of @sam.mckay videos of Advanced DAX Combinations. I need to be patient I guess and try to figure it out

Thanks

Paul