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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
Bhimashankar_Dc
Frequent Visitor

Count the Result Measure to Create Bar Chart

Hi,

 

We have data like bleow where Accrual Booked, Actual Work Accrual Value of Work, Accural Calculated and Result are measures created on fronend,  and Work Unit and FE Class are table column.

 

Work UnitFE ClassAccrual BookedActual Work AccrualValue of WorkAccrual CalculatedResult
301600105273.24979.75568.63243.19Pass
306993105436.6919.45355.57500.85Fail
307820105718.84343.5951.73985.49Pass
308291105534.79195.62396.75461.87Fail
308429105588.93540.06278.7788.87Pass
308961110682.56827.43717.94455.23Pass
308962110303.39558.82292.06966.26Fail
309165205775.87856.5975.73976.75Pass
309355105473.51376.9707.35289.37Pass
309357105718.09105.72516.78542.13Fail
309404110738.12929.66235.01523.45Pass
309633110657.6318.92437.16701.22Fail
309696105326.00336.73573.86735.23Pass
309834105652.22479.43749.98841.46Pass
309883105896.75995.59437.5830.61Fail


Now here we want to create the bar chart based on Result with bars of counts of pass and fail. Can anyone please help me with DAX query that will count the pass and fail and we create bar chart out of it. I tried different DAX query but when the same data is taken into table visual the counts were not matching.

 

Data Fact:

  1. Work Unit will be unique
  2. We have one table with only one column having the value {"Pass" and "Fail"}, this we can use on X-axis for bar charts.

Please let me know if you are having any questions.


Thanks,
Bhimashankar

6 REPLIES 6
dharmendars007
Solution Sage
Solution Sage

Hello @Bhimashankar_Dc , 

 

I created 2 simple measures where for both "Pass and Fail",  you can create Bar chart with this by adding them to x axis..
dharmendars007_0-1724943389532.png

Pass = CALCULATE(

       COUNT('Table'[Work Unit]), 'Table'[Result] = "Pass")
Fail = CALCULATE(
            COUNT('Table'[Work Unit]), 'Table'[Result] = "Fail")

If you find this helpful , please mark it as solution and Your Kudos are much appreciated!

 

Thank You

Dharmendar S

LinkedIN 



I tried using above measure that is giving the different count than the data in table visual.

Are you looking to have only distinct count of work unit if so you can replace count by distint count.

 

If you find this helpful , please mark it as solution and Your Kudos are much appreciated!

 

Thank You

Dharmendar S

LinkedIN 

Even if I use the distinct count it is giving the same result as using count and not matching with the expected results

share us the sample dataset with the expected result and wrong result this will help us to check further...

You can refer to data given in first post, that is data and we are using live connection that time count DAX is not working expected.

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

Check out the October 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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