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
Anonymous
Not applicable

percentile.inc in a matrix based on a column values

Hey there!

File here

I'm trying to create a quartile matrix by using the PERCENTILE.INC() function. When I simply use one of the Q vars listed bellow the table properly calculates the percentile. However, I'd like to create a condition that states the quarter based on a value in a table (within the 'Produtividade' column"). As shown in the image, the formula bears an error. How can I fix that?

Quartil = 
var Q1 = calculate ( PERCENTILE.inc ('QRTL'[produtividade] , 0)   , ALLselected('QRTL'[week start]) , ALLselected('QRTL'[assignee]))
var Q2 = calculate ( PERCENTILE.inc ('QRTL'[produtividade] , 0.25), ALLselected('QRTL'[week start]) , ALLselected('QRTL'[assignee]))
var Q3 = calculate ( PERCENTILE.inc ('QRTL'[produtividade] , 0.5) , ALLselected('QRTL'[week start]) , ALLselected('QRTL'[assignee]))
var Q4 = calculate ( PERCENTILE.inc ('QRTL'[produtividade] , 0.75), ALLselected('QRTL'[week start]) , ALLselected('QRTL'[assignee]))

return SWITCH(TRUE(),
                Qrtl[Produtividade] > Q1 , "Q1",
                Qrtl[Produtividade] > Q2 , "Q2",
                Qrtl[Produtividade] > Q3 , "Q3",
                Qrtl[Produtividade] > Q4 , "Q4",
                blank () )

 

pedrohp503_0-1655834254157.png

 

Here is what the desired table looks like, but instead of the “Quartil” values, I'd like to calculate what Q is the person in a given week.

pedrohp503_1-1655834711591.png

Thanks in advance.

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

I myself found a solution:

 

Quartil = 
var Q25 = calculate ( PERCENTILEX.INC('QRTL semanal', 'QRTL semanal'[produtividade] * 1 , 0.25)  , ALLselected('QRTL semanal'[week start]) , ALLselected('QRTL semanal'[assignee]))
var Q50 = calculate ( PERCENTILEX.INC('QRTL', 'QRTL'[produtividade] * 1 , 0.5)   , ALLselected('QRTL'[week start]) , ALLselected('QRTL'[assignee]))
var Q75 = calculate ( PERCENTILEX.INC('QRTL', 'QRTL'[produtividade] * 1 , 0.75) , ALLselected('QRTL'[week start]) , ALLselected('QRTL'[assignee]))
var geral = calculate ( PERCENTILEX.INC('QRTL', 'QRTL'[produtividade] * 1 , 0.75))
var calculo = switch (
            true () ,
            Q25 > geral , "Q1" ,
            Q50 > geral , "Q2" ,
            Q75 > geral , "Q3" ,
            Q75 < geral , "Q4" ,
            blank () )
return calculo

View solution in original post

1 REPLY 1
Anonymous
Not applicable

I myself found a solution:

 

Quartil = 
var Q25 = calculate ( PERCENTILEX.INC('QRTL semanal', 'QRTL semanal'[produtividade] * 1 , 0.25)  , ALLselected('QRTL semanal'[week start]) , ALLselected('QRTL semanal'[assignee]))
var Q50 = calculate ( PERCENTILEX.INC('QRTL', 'QRTL'[produtividade] * 1 , 0.5)   , ALLselected('QRTL'[week start]) , ALLselected('QRTL'[assignee]))
var Q75 = calculate ( PERCENTILEX.INC('QRTL', 'QRTL'[produtividade] * 1 , 0.75) , ALLselected('QRTL'[week start]) , ALLselected('QRTL'[assignee]))
var geral = calculate ( PERCENTILEX.INC('QRTL', 'QRTL'[produtividade] * 1 , 0.75))
var calculo = switch (
            true () ,
            Q25 > geral , "Q1" ,
            Q50 > geral , "Q2" ,
            Q75 > geral , "Q3" ,
            Q75 < geral , "Q4" ,
            blank () )
return calculo

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.