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
MikeGaunt
Regular Visitor

Count IF / 'Set Analysis'

Hi All, 

Just started a new job where they use Power BI, having used Qlik in the past I am having trouble with getting the correct outputs. 

 

If I consider the table below 

 

MikeGaunt_0-1644858343917.png

 

ideally I need the counts for the coulmn to be summed and then the count of 1 to be divided by the total per month 

 

as the below (Which works for one month but not when I add additional months data in)

 

MikeGaunt_1-1644858506739.png

as we can see 118/175 = 67.43%

 

hope this makes sense

 

Thanks in advance I am learning 

 

@countif

@IF

 

 

 

9 REPLIES 9
v-yalanwu-msft
Community Support
Community Support

Hi, @MikeGaunt ;

You could modify it.

Measure = DIVIDE( COUNT([count]),CALCULATE(COUNT([count]),FILTER(ALL('Table'),[Month]=MAX([Month])&&[Vendor]=MAX([Vendor]))))

The final output is shown below:

vyalanwumsft_0-1645516515423.png

 


Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

v-yalanwu-msft
Community Support
Community Support

Hi, @MikeGaunt ;

If you could  post sample data as text and expected output,It makes it easier to give you a solution.

 

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-yalanwu-msft 

 

I will do my best. 

 

so the raw data will come across like this 

 

VendorName 1Purchasing DocumentMaterialMaterial descriptionPurchasing GroupMonthMaterial Doc. YearCorr. Qty. Reliab.Correction On-time delSched. dateGR dateSchedule line numberPost.qty.Quantity ReceivedScheduled QuantityDays to late WEDays to early WEDelivery NoteChanged byChanged OnDat.reliab.

 

and effectively for each Month and Vender I need to track the percentages of the 100. 

 

as below 

MikeGaunt_0-1645179976877.png

 

and then graphically represent it. 

 

MikeGaunt_1-1645180023341.png

 

Thanks for all the support.

 

MikeGaunt_2-1645180534752.png

 

 

 

 

 

 

 

 

v-yalanwu-msft
Community Support
Community Support

Hi, @MikeGaunt ;

You could create a measure as follows:

Measure = 
DIVIDE( SUM([Count of C olumn]) ,CALCULATE(SUM([Count of C olumn]),ALLEXCEPT('Table','Table'[Month])))

Or

Measure = 
DIVIDE( SUM([Count of C olumn]) ,CALCULATE(SUM([Count of C olumn]),FILTER(ALLSELECTED('Table'),[Month]=MAX([Month]))))

The final output is shown below:

vyalanwumsft_0-1645063474924.png

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-yalanwu-msft This works great Thank you, 

 

Per chance are you able to guide me on replicating this in a graph. 

 

So the vendor would act as the Legend, the month as the x axis and the Measure as the value  BUT only for the the 100 percentages. 

 

so plot Month 1, Vendor VO640  = 69.15% to be plotted on a graph. 

 

I have tried to do this but cannot seem to get the right output. 

 

Thanks in advance. 

 

Hi,@MikeGaunt ;

Why don't Vendor set Count of Column as Legend? If Vendor is set as Legend, logically it must be 100%, so you can try to set Count of Column as Legend.

vyalanwumsft_0-1645147923827.png

The final output is shown below:

vyalanwumsft_1-1645147950564.png


Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-yalanwu-msft 

 

Thanks for the input, however I believe my issue is that the "Count of the column " is already a generated field it is not part of the intial load.

 

Column = count(Sheet1[Correction On-time del])

 

Whereas I see in your example it is loaded as a field. 

 

My other issue that will come into it is that there will be multiple vendors within the data set, currently I am working with a smaller dataset in order to learn and practice. 

 

script is below 

 

= Table.TransformColumnTypes(#"Promoted Headers",{{"Vendor", type text}, {"Name 1", type text}, {"Purchasing Document", Int64.Type}, {"Material", type text}, {"Material description", type text}, {"Purchasing Group", type text}, {"Month", Int64.Type}, {"Material Doc. Year", Int64.Type}, {"Corr. Qty. Reliab.", Int64.Type}, {"Correction On-time del", Int64.Type}, {"Sched. date", type date}, {"GR date", type date}, {"Schedule line number", Int64.Type}, {"Post.qty.", Int64.Type}, {"Quantity Received", Int64.Type}, {"Scheduled Quantity", Int64.Type}, {"Days to late WE", Int64.Type}, {"Days to early WE", Int64.Type}, {"Delivery Note", Int64.Type}, {"Changed by", type text}, {"Changed On", type date}, {"Dat.reliab.", Int64.Type}})

 

MikeGaunt
Regular Visitor

Hi @amitchandak 

 

In the top table the total is across all months whereas it needs to be each each month as in the second table. 

amitchandak
Super User
Super User

@MikeGaunt , what is wrong and what is expected output

% of grand total when [Count of column] is a measure

 

divide( [Count of column], calculate( [Count of column], allselected())  )

 

If this does not help
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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