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

Calculate Coefficient of Variation for Category

Hi everyone,

you have been very Helpfull to me and i really appreaciate that. 

 

I'm trying to calculate the Coefficent of variance for different Product name. I have 300 Product name 

and their Selling Price. Also I will apply outside filter for Regions. 

 

I used the Quick measure in power bi 

 

Vari = VARX.P(KEEPFILTERS(VALUES('TABLE'[Product NAME])), CALCULATE [ Selling Price]))

 

Selling Price is Calculated measure. 

 

but the result was 0.00 for all the products. i'm not sure where is the problem ?

4 REPLIES 4
v-angzheng-msft
Community Support
Community Support

Hi, @SalmanABDul_97 

May I ask if your problem has been solved? Is the above post helpful to you?

Could you please consider sharing more details about it and posting expected result so it is clear on what needs to be implemented?  And It would be great if there is a sample file without any sesentive information here.

 

It makes it easier to give you a solution.

  1. Sample (dummy dataset) data as text, use the table tool in the editing bar
  2. Expected output from sample data
  3. Explanation in words of how to get from 1. to 2.

 

Best Regards,
Community Support Team _ Zeon Zheng

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

Daryl-Lynch-Bzy
Resident Rockstar
Resident Rockstar

Hi @SalmanABDul_97 - it difficult to comment with access to the underlying data model, but I am not sure why or if you need CALCULATE to change the filter context.  It might help to read the following blog on ALLSELECTED to understand what is happening in the background.  The definitive guide to ALLSELECTED - SQLBI

 

Daryl-Lynch-Bzy
Resident Rockstar
Resident Rockstar

Hi @SalmanABDul_97 , the DAX syntax does not look correct.  "Keepfilters(Value('Table'[Product Name]))" will be a table containing one column with Product Names, it will not contain the Selling Price.  "Calculate ( [Selling Price] )" would not be correct because it is expecting a column not a measure.

 

Please consider the following VARX.P - DAX Guide for more information.

 

It is possible that you need to create a table Variable like this.

 

CoV = 
VAR _temp = SUMMARIZE ( Table, Table[Product Name] )
VAR _add = ADDCOLUMNS ( _Temp, "Add Selling Price" , [Selling Price] )
RETURN
VARX.P( _add, [Add Selling Price] )

 

 

 

I used this dax function for calculating STD 

STD = Calculate(STDEVX.P('fact table', [Value]) , ALLSELECTED () )

the issue with this is it give me wrong std , greater than mean. 

 

same dax i used to find CV but its give me high cv number >100 

 

and problem is beacuse it calculate std wrong. 

 

i need it dynamic whenever i change out filter it should change so i used ALLSELECTD

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.