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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
MayankMit1625
Regular Visitor

How to count consecutive columns to count the values with non blank cells

Here Plant1, Plant 2 etc tells how many operation does Company has under that Plant.

I want to calculate the "Net" value has the COUNT of cells that are filled from Plant1 to Plant 5 and then calculate the total number of rows under "Net" which has all 5 plants 

MayankMit1625_0-1644141193099.png


Final result is "Total together" i.e. Organization that has operation in all the 5 plants.

Total Together counts the number of "5" in Net column

I used measures to calculate the values but wasn't able to get to the solution.
Please help!

1 ACCEPTED SOLUTION
V-lianl-msft
Community Support
Community Support

Hi @MayankMit1625 ,

 

In the query editor, select the org column then unpivot other columns:

Vlianlmsft_0-1644470711033.png

Then create 2 measures like below:

Net = 
 CALCULATE(DISTINCTCOUNT('Table'[Attribute]),ALLEXCEPT('Table','Table'[Org Name]))


Total Together = CALCULATE(DISTINCTCOUNT('Table'[Org Name]),FILTER('Table',[Net]=5))

Vlianlmsft_1-1644471183802.png

 


Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
V-lianl-msft
Community Support
Community Support

Hi @MayankMit1625 ,

 

In the query editor, select the org column then unpivot other columns:

Vlianlmsft_0-1644470711033.png

Then create 2 measures like below:

Net = 
 CALCULATE(DISTINCTCOUNT('Table'[Attribute]),ALLEXCEPT('Table','Table'[Org Name]))


Total Together = CALCULATE(DISTINCTCOUNT('Table'[Org Name]),FILTER('Table',[Net]=5))

Vlianlmsft_1-1644471183802.png

 


Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

mahoneypat
Employee
Employee

You really should consider unpivoting your data to simplify your analysis and visualization. The unpivot action will remove any combinations with null, and then you can do a simple DISTINCTCOUNT of the Attribute (Plant) column, or FILTER for organizations where the DISTINCTCOUNT of Plant = 5.

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.