Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Calculated Column

Hi Guys,

 

Please refer the below  table where I have the first 2 columns in my report and the 3rd is the desired column when the Annual Usage is divided by 1000 where ever type name is Electric. 

 

Can you help me with the measure to get this?

 

I've tried calculate function but its not helping me. Below is the expression used by me:

 

Annual Usage (MWh) = CALCULATE(SUM(Deals[AnnualUsage]),FILTER(Deals,Deals[typename]="Electric"))/1000

 

What should I use instead of sum to make it work?

 

Regards,

Himanshu

 

Annual UsageTypenameDesired Output Column: Annual Usage (MWh)
1614892Electric1615
100000Gas0
175400Electric175.4
2356765Gas0
16877654Electric16878
  • Anonymous , Try a measure like

    Annual Usage (MWh) = round(CALCULATE(SUM(Deals[AnnualUsage]),FILTER(Deals,Deals[typename]="Electric"))/1000.0,0)

     

     

    Or new column like

    new column = if([typename]="Electric", round([AnnualUsage]/1000.0,0), 0) +0 

4 Replies

  • Anonymous , Try a measure like

    Annual Usage (MWh) = round(CALCULATE(SUM(Deals[AnnualUsage]),FILTER(Deals,Deals[typename]="Electric"))/1000.0,0)

     

     

    Or new column like

    new column = if([typename]="Electric", round([AnnualUsage]/1000.0,0), 0) +0 

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks for your help !!!

       

      The below solved my issue

       

      new column = if([typename]="Electric", round([AnnualUsage]/1000.0,0), 0) +0 

       

      Regards,

      Himanshu

  • aj1973's avatar
    aj1973
    Community Champion

    Hi Anonymous 

    the measure is correct if you want to see the aggregation filtered by Electric in a Card Visual not in the Table

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    amitchandak Hi Amit,

     

    Actually there is an issue with the column I created.

     

    Please refer the below table:

     

    Annual UsageTypenameDesired Output Column: Annual Usage (MWh)Unit
    1614892Electric1615kwh
    100000Gas0THM
    175400Electric175400MWh
    2356765Gas0THM
    16877654Electric16878kwh

     

    I actually want the desired output column for the unit kwh only. I dont want values for "Unit" MWh to change.

    What can be done in this scenario?

    new column = if([typename]="Electric", round([AnnualUsage]/1000.0,0), 0) +0 : I want a filter where Unit = kwh in my calculation.

     

    I'm basically converting only kwh values to MWh.

     

    Regards,

    Himanshu