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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Matias_Tiberio
New Member

Error in calculation of a KPI

Hi everyone! I'm currently having a weird issue. I've made the following parameters to create a KPI which does this:

 

In one side you have last month avg sales $, calculated by the n of days from the last month:

Promedio_Facturacion = SUM('Mes pasado'[FACTURACION])/DAY(ENDOFMONTH('Mes pasado'[FECHA]))
 
Then you have the current month:
Promedio Facturacion_act = SUM('Mes actual'[FACTURACION])/DAY(TODAY())
 
Then I have to calculate the percentage increase/decrease between those 2 numbers:
vs Mes Anterior (Facturacion) = ([Promedio Facturacion_act] - 'Mes pasado'[Promedio_Facturacion])/'Mes pasado'[Promedio_Facturacion]
 
Once I have that calculation, I've elaborated a KPI based on the following:
KPI = IF([vs Mes Anterior (Facturacion)] <= -0.20, "CRITICO", IF([vs Mes Anterior (Facturacion)] <=-0.10, "ALERTA", IF([vs Mes Anterior (Facturacion)] < 0, "CUIDADO", "OK")))
 
Problem is that isn't working propperly, for example:
Matias_Tiberio_0-1650313892070.png

 

First case is -0.7 which is critical, wrong since it has to count from -0.20. But what kills me is that 0.67 is Critical and 0.8 is OK. Its boggling me for sure. Do you have any tips for this?

 

Thanks!

 
UPDATE:
 
I saw that what is causing this issue is that the KPI metric was made as a Column. When I transpose it as a Metric this error doesn't happen, but, you loose the opportunity of using the KPI as a filter for example.
Furthermore, when the KPI is used as a column, since this query tracks transactions daily, what happens is that it issues an status for each transaction and, when data is resumed by unique ids, this status sum up displaying the most repetitive ocurrence, not the accorded one.
I was thinking maybe a SUMMARIZE would help?
3 REPLIES 3
v-janeyg-msft
Community Support
Community Support

Hi, @Matias_Tiberio 

 

Are these two tables related? I don't know the specific situation. You may need to modify these two codes to make them constant (it can still change after each refresh or open). 

vjaneygmsft_0-1650521805466.png

Can you share some sample data and more datails? So I can check if it has a workaround.

 

Best Regards,
Community Support Team _ Janey

Whitewater100
Solution Sage
Solution Sage

Hi:

Are you able to try this for month to date avg sales?  You can sub in your name for DateTable[Date] where I have Dates[Date]..

Facturacion_act = SUM('Mes actual'[FACTURACION])

MTD Facturacion_act = CALCULATE(Average([Facturacion_act] ),DATESMTD('Date'[Date]))

LY MTD = CALCULATE([Facturacion_act], SAMEPERIODLASTYEAR(Dates[Date])

Then do your measures for the difference as a percent?

Hi! Yes, kind of, instead of that (since it was already built in this way by other member) I'm using the same FACTURACION metric from two different queries, one from last month and one from the current one. Then there's the calculation of the difference as a percent. 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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