Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

DAX Query

Hi ..I am new to DAX ... Pls help me.... I have to get the difference of values based on two entries of the same column & time. How can I get the  difference of Telemetry values of SensorID 975425 & 975424 wrspt to time? TIA

SpartaBI 

  • Anonymous's avatar
    Anonymous
    4 years ago

    Okay, then you can modify your measure a bit;
    Difference=CALCULATE(SUM(Table[Telemetry]),Table[SensorID]="975425") - CALCULATE(SUM(Table[Telemetry]),Table[SensorID]="975424").


    Let me know if that helps.

5 Replies

  • SpartaBI's avatar
    SpartaBI
    Community Champion

    Anonymousin case I understood what you meant then if you use the measure that Anonymous sent you and put dates on the axis of the column you will get the differenct per each row in the table visual.
    If you want to also see the values for each Sensor on the table you can also add 2 measures and them also to the table.
    975425_Value = CALCULATE(SUM(Table[Telemetry]),Table[SensorID]="975425")
    975424_Value = CALCULATE(SUM(Table[Telemetry]),Table[SensorID]="975424")




    Showcase Report – Contoso By SpartaBI


          

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous .

    If dates in both the columns are exact same then I think you can directly calculate the difference between Telemetry columns subject to a active relationship between this 2 tables based on 'Time' Column.

    Create a measure as Difference=SUM(Table1[Telemetry])-SUM(Table2[Telemetry])



    If this post helps, then mark it as "Accept as Solution"  and give it a thumbs up.


    • Anonymous's avatar
      Anonymous
      Not applicable

       

      Hi Thank you for your response. But I have only one table , where the SensorID field contains the values based on which I have to do the comparison.

      • Anonymous's avatar
        Anonymous
        Not applicable

        Okay, then you can modify your measure a bit;
        Difference=CALCULATE(SUM(Table[Telemetry]),Table[SensorID]="975425") - CALCULATE(SUM(Table[Telemetry]),Table[SensorID]="975424").


        Let me know if that helps.