Forum Discussion

Syndicate_Admin's avatar
Syndicate_Admin
Administrator
2 years ago

Incorrect table sum

Good.

I have a table in which I calculate a cost, this comes from the measurement

Cost = (TOTAL/TOTAL_MES) * TOTAL_UNIDAD

Total month and unit are from the same table, the total is not.

In the following image I want to calculate the sum of the green, since the total shows me some values that lead me to error, the table is applied the date and unit filter that makes total unit vary.

I really work with 6 units but I have put that the ones with total unity to zero do not appear, it would really be like this:

Any ideas to show on a card only the sum of the values in the cost column.

Thanks a lot

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Syndicate_Admin ,

    You can modify your meaure like below:

     

    Result = 
    CALCULATE(
        SUMX(
            'Table' ,
            ( 'Table'[TOTAL] / 'Table'[TOTAL_MES]) * 'Table'[TOTAL_UNIDAD]
        ),
        ALLSELECTED('Table'[Date]),
        ALLSELECTED('Table'[Unit])
    )

     

    How to Get Your Question Answered Quickly - Microsoft Fabric Community

    If it does not help, please provide more details with your desired out put and pbix file without privacy information.

     

    Best Regards,

    Ada Wang

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

    • Aguirre's avatar
      Aguirre
      Helper IV

      Good.

      I have tried the measurement and it does not work correctly for me as you can see in the picture:

      I detail in the image the adapted measure and the other disaggregated measures, I am going to try to set up an example in .pbix,

      COSTE_FORO =
      CALCULATE(
      SUMX(
      'F_BI_REPARTO' ,
      ( [TOTAL] / [TOTAL_MES]) * F_BI_REPARTO[TOTAL_UNIDAD]
      ),
      ALLSELECTED(Calendar[Date]),
      ALLSELECTED(F_BI_FARMACIA_REPARTO_HOSP[UNIT])
      )
      TOTAL_MES=
      CALCULATE(
      SUM( F_BI_REPARTO[TOTAL_UNIDAD]),
      REMOVEFILTERS(F_BI_REPARTO[UNIT])
      )
      TOTAL = SUMX(
      F_BI_GESTION,
      F_BI_GESTION[Cantidad_Signo]*F_BI_GESTION[PRECIO_MEDIO]
      )