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

Matrix | Values above rows

Hi experts!

 

 

We have a basic matrix with columns, rows and values.  I need to calculate the KPI of the attached screen. The formula to calculate it can be found in the image, but is :

 

MAX((Precio Medio - ABOVE(Precio Medio))*Segmentos    GroupBy Antelación.

 

 

 

ThanksCaptura.PNG

1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

hi, @Setroc

After my research, you could do these as below:

Add a index column for day type

10.JPG

Step2:

Use EARLIER Function to add a KPI column

KPI = (Table1[Precio Medio]-CALCULATE(SUM(Table1[Precio Medio]),FILTER(Table1,Table1[Index]=EARLIER(Table1[Index])+1 )))*Table1[Segmentos]

11.JPG

Step3:

You could create a calculate table or a measure to find Max KPI value

a) create a calculate table 

Table = FILTER(Table1,Table1[KPI]=MAX('Table1'[KPI]))

12.JPG

b)create a calculate measure

MAX KPI = var _maxkpi= CALCULATE(MAX(Table1[KPI]),ALL(Table1[day type])) return
IF(MAX(Table1[KPI])=_maxkpi,_maxkpi,BLANK())

13.JPG

 

Here is pbix, please try it.

https://www.dropbox.com/s/incp3spymf8q2ba/Matrix%20%20Values%20above%20rows.pbix?dl=0

 

Best Regards,

Lin

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

View solution in original post

2 REPLIES 2
v-lili6-msft
Community Support
Community Support

hi, @Setroc

After my research, you could do these as below:

Add a index column for day type

10.JPG

Step2:

Use EARLIER Function to add a KPI column

KPI = (Table1[Precio Medio]-CALCULATE(SUM(Table1[Precio Medio]),FILTER(Table1,Table1[Index]=EARLIER(Table1[Index])+1 )))*Table1[Segmentos]

11.JPG

Step3:

You could create a calculate table or a measure to find Max KPI value

a) create a calculate table 

Table = FILTER(Table1,Table1[KPI]=MAX('Table1'[KPI]))

12.JPG

b)create a calculate measure

MAX KPI = var _maxkpi= CALCULATE(MAX(Table1[KPI]),ALL(Table1[day type])) return
IF(MAX(Table1[KPI])=_maxkpi,_maxkpi,BLANK())

13.JPG

 

Here is pbix, please try it.

https://www.dropbox.com/s/incp3spymf8q2ba/Matrix%20%20Values%20above%20rows.pbix?dl=0

 

Best Regards,

Lin

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

@v-lili6-msft Thanks a lot!

 

 

 

But the problem is my row-data is like :

 

rowdata.PNG

 

And i create the Master file to order de days field :

 

antelacion.PNG

 

Finally, my model looks:

 

relation.PNG

 

Your solution is finde in query view, but the data is not equal.

 

Thanks for ur help!

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.