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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Fariba1984
Frequent Visitor

VARX.P retruns minus value in dax, why?

Hi experts,

I would like to calculate Variance of some values with this dax code:

Gesamtauslastung:= 

var x=  SUMX(CheckoutUtilization;CALCULATE(((CheckoutUtilization[NumberOfParallelCheckouts] / CheckoutUtilization[MaxNumberOfCheckouts])* CheckoutUtilization[MinutesOfParallelCheckoutUsage]) / CheckoutUtilization[DailyTotalMinutesOfCheckoutUsage];CheckoutUtilization[Date_SID];CheckoutUtilization[_NumberOfParallelCheckouts]))
return CALCULATE(VARX.P(CheckoutUtilization;x);ALLSELECTED('date'))

 

But what I see as result is minus values, as I understood Variance is allways +. Why do I get such a result?

2020-08-06 14_51_49-Mappe1 - Excel.png

 

1- I would like to calculate variance of these values.
As you can see reault of variance is minus

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

[Auslastung] = 
    SUMX(
        CheckoutUtilization,
	CheckoutUtilization[NumberOfParallelCheckouts]
	/ CheckoutUtilization[MaxNumberOfCheckouts]
    	* CheckoutUtilization[MinutesOfParallelCheckoutUsage]
        / CheckoutUtilization[DailyTotalMinutesOfCheckoutUsage]
    )

Gesamtauslastung :=
    CALCULATE(
        VARX.P(
            CheckoutUtilization,
            [Auslastung]
        ),
        ALLSELECTED( 'date' )
    )

You need something like the above...

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

These are NOT negative values. These are 0's. What you see is the outcome of rounding at the machine level. You get 0's because variables in DAX are not recalculated, they retain their value throughout the entire calculation. So, they are set in stone once you define them. Your x never changes, hence you see 0's.
Anonymous
Not applicable

[Auslastung] = 
    SUMX(
        CheckoutUtilization,
	CheckoutUtilization[NumberOfParallelCheckouts]
	/ CheckoutUtilization[MaxNumberOfCheckouts]
    	* CheckoutUtilization[MinutesOfParallelCheckoutUsage]
        / CheckoutUtilization[DailyTotalMinutesOfCheckoutUsage]
    )

Gesamtauslastung :=
    CALCULATE(
        VARX.P(
            CheckoutUtilization,
            [Auslastung]
        ),
        ALLSELECTED( 'date' )
    )

You need something like the above...

Greg_Deckler
Super User
Super User

@Fariba1984 - VARX.P uses the formula:

 

∑(x - x̃)2/n

 

So if n is negative, I suppose you will get negative results.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

It is population size and population size can not be  negative

@Fariba1984 - Well, it wouldn't be the first time I found weirdness with DAX functions. https://community.powerbi.com/t5/Quick-Measures-Gallery/To-bleep-with-MOD/m-p/1081806#M509

 

You could check the Issues forum here:

https://community.powerbi.com/t5/Issues/idb-p/Issues

And if it is not there, then you could post it.

If you have Pro account you could try to open a support ticket. If you have a Pro account it is free. Go to https://support.powerbi.com. Scroll down and click "CREATE SUPPORT TICKET".


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors