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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Olamum
Helper II
Helper II

Count multiple columns with true values

Change_1change_2change_3

TRUEFALSETRUE
FALSE TRUE
TRUETRUETRUE


First row result should be = 2 because true appears twice

second row = 1

third row = 3

 

 I want to count the value of each row = "True" in Powerbi 

2 REPLIES 2
Resolutions
Regular Visitor

@Olamum In Power BI, you can easily calculate the count of "True" values for each row using the DAX (Data Analysis Expressions) language.

 

Follow these steps to achieve the desired result:

Step 1: Load your data into Power BI:
Ensure that your data is loaded into Power BI, and the columns are appropriately named.

 

Step 2: Create a New Column for Counting "True" Values:
Go to the Power BI Data View. Right-click on your table, then select "New Column" from the context menu. Name the new column, for example, "TrueCount."

 

Step 3: Write the DAX Expression:
In the formula bar, write the DAX expression to calculate the count of "True" values for each row. The expression uses the functions `IF` and `COUNTROWS` to achieve this. Assuming your table is named "YourTable," and the columns are named "Change_1," "Change_2," and "Change_3," the DAX expression would be:

```DAX
TrueCount =
COUNTROWS(
FILTER(
YourTable,
[Change_1] = TRUE() ||
[Change_2] = TRUE() ||
[Change_3] = TRUE()
)
)
```

Step 4: Apply the Expression:
Press Enter to apply the DAX expression. Power BI will calculate the "TrueCount" for each row based on the conditions specified.

 

Step 5: Check the Results:
Navigate back to the Power BI report view, and you should see a new column named "TrueCount" displaying the count of "True" values for each row in your table.

 

Now, your Power BI report should display the desired count of "True" values for each row, as you described:

- First row result = 2 because "True" appears twice.
- Second row result = 1.
- Third row result = 3.

You can then use this "TrueCount" column in your visualizations or further analysis as needed.

It didn't work. It was adding all the rows that doesnt even have true value

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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