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
Bnb99
Frequent Visitor

Using the Correct DAX to count multiple rows as 1

I am very new to Power BI and DAX. I did a search to solve a problem with previous data using the Distinctcount code. it worked well in combining rows with the same value in the "record number colum". I am trying to the same thing, but with a diffrent colum. With the multiple records, I am trying to count the "true" as one event. (note this colum has both true and false values). What is the best way to go around doing this? The data is all on the same table, I think I am trying to filter out "true" in the distinct count, but not sure if I am explaining it correctley!

Power BI Question.PNG

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@Bnb99 create a measure m1 = distinctcount(table1[recordnumber]) assuming record number is going to be unique accross all the injuries related to 1 persion in the visual level. in the chart visual filters or page level filter just select recordable = true

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

@Bnb99 you are trying to calculate distinctcount of true per some variable. i am not sure which variable based on the information provided. can you post pic of the model and details on what you want to calculate, and what is the expected output.

POwer BI.PNGBI DAX.PNG

So what I am trying to measure is the number of incidents in a given month. (the image above in pink shows what I want to show in the visual.). In the previous post shows the column highlighted in grey, the incident  "record number".  If you move to the next column to the right, it identifes the body part that was injured. The data spilts up the incidents in to multiple rows if multiple body parts are entered in to the database, hence why you see three "312" record numbers, but it's only 1 incident. The final column shows true or false values. this is indicating that the incident resulted in an OSHA recordable (true meaning, yes it was an recordable incident). Currently, without any filtering, calculating, DAX or grouping the chart would show I have 3 OSHA recordables, but I really have one. How can I get the data, to look at the table and recognize that this as one event?

 

I want to avoid grouping as I noticed when using this feature, and more data is entered, the new data does not automatically get grouped, and I have to manually fix it. (unless I am doing that wrong....remember I am very new at all this!)  I was hoping using distincint count, and some kind of "filter" DAX would help.

 

Hopefully this clears up my question.

Anonymous
Not applicable

@Bnb99 create a measure m1 = distinctcount(table1[recordnumber]) assuming record number is going to be unique accross all the injuries related to 1 persion in the visual level. in the chart visual filters or page level filter just select recordable = true

Thank you! This works!

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.