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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
leanmap
Frequent Visitor

Average Cost Triangle/Triangulo de costo Medio

Good afternoon,

I am trying to create an average cost triangle like the following example:

 12345678910111213
2023 Q1 1994  3476 4340 47115556640172468091893697811062611471 
2023 Q281691063911051114631187512287126991311113523    
2023 Q330003084316832523336

3420

       
2023 Q4478055216262          

 

The data shown is in 2023 Q1 row 1, it is the average cost of January only, then row 2 is the cumulative data of January, February, and row 3 is January, February, March, but in row 4 I need to get the average cost of the data of this quarter but with the data that was loaded in April with opening date in 2023 Q1 (January, February, March) which may have an increase or decrease.

What I have so far, I am doing it with the following formula

 

VAR valor = CALCULATE( DISTINCTCOUNT(BBDD[Id_Case]), USERRELATIONSHIP(Calendar[Date], BBDD[Open_Date]) ) RETURN CALCULATE( Valor, FILTER(ALL(BBDD[Id_Case]), BBDD[Id_Case] <= MAX(BBDD[Id_Case])) )

I did the same to calculate the cost and then divided the two measures.

 

Below is a sample table

 

Thank you in advance

---------------------------------------------------------------------------------------------------

 

 

Buenas tardes,

Estoy tratando de hacer un triangulo de coste como el siguiente ejemplo


 12345678910111213
2023 Q1 1994  3476 4340 47115556640172468091893697811062611471 
2023 Q281691063911051114631187512287126991311113523    
2023 Q330003084316832523336

3420

       
2023 Q4478055216262          

 

Los datos que se ven son en el 2023 Q1 fila 1, es el promedio de costos unicamente de Enero, luego en la fila 2 son los datos acumulados de Enero, Febrero, y en la 3 de Enero, Febrero, Marzo, pero en la fila 4 debo obtener el costo medio de los datos de este trimeste pero con los datos que se cargaron en Abril con fecha de apertura en el 2023 Q1 (Enero, Febrero, Marzo) que pueden tener un aumento o disminucion.

Lo que tengo hasta ahora, lo estoy haciendo con la siguiente formula:


VAR valor = CALCULATE(
                                       DISTINCTCOUNT(BBDD[Id_Case]), USERRELATIONSHIP(Calendar[Date], BBDD[Open_Date))

 

RETURN 

       CALCULATE(Valor,
                           FILTER(ALL(BBDD[Id_Case]), BBDD[Id_Case] <= MAX(BBDD[Id_Case])))

Hice lo mismo para calcular el costo y luego dividi las dos medidas.

Algunos datos de ejemplo de la tabla:

 

Id_CaseOpen_DateCharge_dateCost
250010/01/202301/01/20231500
250413/01/202301/01/20231747
257816/01/202301/01/20231994
265219/01/202301/01/20232241
272622/01/202301/01/20232488
280025/01/202302/02/20232735
287428/01/202302/02/20232982
294831/01/202302/02/20233229
302203/02/202302/02/20233476
309606/02/202302/02/20233723
317009/02/202302/02/20233970
324412/02/202302/02/20234217
331815/02/202302/02/20234464
339218/02/202302/02/20234711
346621/02/202302/02/20234958
354024/02/202302/02/20235205
361427/02/202302/02/20235452
368802/03/202302/03/20235699
376205/03/202302/03/20235946
383608/03/202302/03/20236193
391011/03/202302/03/20236440
398414/03/202302/03/20236687
405817/03/202302/03/20236934
413220/03/202302/03/20237181
420623/03/202301/04/20237428
428026/03/202301/04/20237675
435429/03/202301/04/20237922
442801/04/202301/04/20238169
450204/04/202301/04/20238416
457607/04/202301/04/20238663
465010/04/202301/04/20238910
472413/04/202301/04/20239157
479816/04/202301/04/20239404
487219/04/202301/04/20239651
494622/04/202301/04/20239898
502025/04/202301/05/202310145
509428/04/202301/05/202310392
516801/05/202301/05/202310639
524204/05/202301/05/202310886
531607/05/202301/05/202311133
539010/05/202301/05/202311380
546413/05/202301/05/202311627
553816/05/202301/05/202311874
561219/05/202301/05/202312121
568622/05/202301/05/202312368
576025/05/202301/05/202312615
583428/05/202301/05/202312862
590831/05/202301/05/202313109

 

Muchisimas gracias!!

4 REPLIES 4
leanmap
Frequent Visitor

exactly, and assign for each charge date, the date of the corresponding quarter.

 

Thanks

leanmap
Frequent Visitor

Hello Ibendlin
My output is the average of the cost column, it depends on the Open_Date and Charge data column, and I have to visualize it by quarter, for example I add what I would have to see in each box of the table, if it is not clear let me know:

 123456789101112 
2023 Q1 January (Avg Cost Open_Date and Charge_Date January) Febreary
(Avg Cost Open_Date and Charge_Date January + February) 

March

Febreary
(Avg Cost Open_Date and Charge_Date January + February + March) 

 April

(Avg Cost Open_Date (January + February + March) but Charge_Date (April)

MayJuneJulyAugustSeptember    
2023 Q2

April 

 

(Avg Cost Open_Date and Charge_Date April)

May

 

(Avg Cost Open_Date and Charge_Date April + May)

June

 

(Avg Cost Open_Date and Charge_Date April + May +June)

July

 

(Avg Cost Open_Date (April + May + June) but Charge_Date (July)

AugustSeptemberOctoberNovember     
2023 Q3JulyAugustSeptemberOctoberNovember

December

       
2023 Q4OctoberNovemberDecemberJanuary (Next Year)         
2024 Q1             


My sample data is from only 5 months, but my actual data spans from 2020 onward.

I leave you images of what I have:

Open_date = Fecha_Ocurrencia
Charge_date = Fecha_Carga
Cost = Carga Siniestral

 

leanmap_0-1707662600178.png

leanmap_1-1707662635640.png

leanmap_2-1707662667151.png

 

Thank in advance

 

So for January you would want to ignore the entries that have a charge date in February?

 

lbendlin_0-1707682952505.png

 

lbendlin
Super User
Super User

What are the columns in your expected output?  weeks in the quarter?

 

Your sample data only has five months?

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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