Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

DAX

Hello guys, hope you're all doing well.

I didn't find any answers to my question so I'm asking it to you. Maybe you'll help me to solve this "issue".

 

I have this graph I made, showing the delta of prices bewteen 2 databases. In fact, I want to display, using a card, the number of points being negative or positive (not interested in knowing how many are accounting for a delta of 0).

I tried using DAX but I can't even formulate including my "Delta" as it's already a measure I made.

Here is a screenshoot of the graph.

 

Any advice on this point ?

 

Thanks in advance for your help šŸ™‚

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Anonymous ,

    Now that you have created a measure for deltas, you can use the existing measure to create another measure to calculate positive and negative deltas. You can try following these steps:

    1. You need to create a new measure.

     

    MEASURE = 
    VAR _1 =
        CALCULATE ( COUNTROWS ( 'Table' ), FILTER ( 'Table', 'Table'[Price] > 0 ) )
    VAR _2 =
        CALCULATE ( COUNTROWS ( 'Table' ), FILTER ( 'Table', 'Table'[Price] < 0 ) )
    RETURN
        IF ( SELECTEDVALUE ( 'Table (2)'[Selected] ) = "+", _1, _2 )
    

     


    Final output:

     

    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.

5 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hello, sorry. 

      This is an idea of how I would like my card to look like. Basically counting the number of negatives or positive points on my graph.

       

      Thank you!

      • Daniel29195's avatar
        Daniel29195
        Community Champion

        Anonymous 

        assuming

        your delta measure =    delta_m

         

        now the requirement is that you want to count the nb of negative or positive ( let u stick to pos in this exmaple ) 

         

         

         

        your new measure = 

         

        var ds = 

        countx(

        filter(

        addcolumns( 

        values(tbl_name[col_name]) ,

        "@delta " , [delta_m]

        ) , 

        [@delta] > 0 
        ),

        tbl_name[col_name]

        )

         

         

        this should work . 

         

         

        nb: replce tbl_name[col_name] with the groupby column you are calculating your deltas based on .

         

        ex : 

        you want nb of post delta grouped by customer name ; 

        then  tbl_name[col_name] ===  dimcustomer[customr_name]

         

        hope this make sense. 

         

         

         

        If this helped you solved your question ,  mark it as the solution āœ… so can you can help other people in the community find it easily .

         

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hello! thanks for your message.

    Unfortunately, it's not working but I'm trying to find another way to display these information.

     

    Thank you for your help!

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

    Now that you have created a measure for deltas, you can use the existing measure to create another measure to calculate positive and negative deltas. You can try following these steps:

    1. You need to create a new measure.

     

    MEASURE = 
    VAR _1 =
        CALCULATE ( COUNTROWS ( 'Table' ), FILTER ( 'Table', 'Table'[Price] > 0 ) )
    VAR _2 =
        CALCULATE ( COUNTROWS ( 'Table' ), FILTER ( 'Table', 'Table'[Price] < 0 ) )
    RETURN
        IF ( SELECTEDVALUE ( 'Table (2)'[Selected] ) = "+", _1, _2 )
    

     


    Final output:

     

    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.