Forum Discussion

Terp's avatar
Terp
Advocate III
5 years ago
Solved

Change Card (X/Y) Position Based on Values?

...perhaps my strangest question yet, but please stay with me. πŸ™‚

 

Picture a balance scale with a value on each side. I have the scale graphic change (lowside on the right if running a deficit; the scale flips horizontally and the lowside is on the left when running a surplus) based on the value of a variable.

 

HOWEVER, when the scale flips, I need the cards used to show the respective values for each side of the scale to move accordingly (if the right-side card was low, it needs to be raised up, say, 100 pixels to give the appearance of resting on the scale when it flips, if that makes sense). 

 

In short, is there some DAX to change the location where the card is compiled on the screen? 

 

---if 'balance of trade' <0, then increase Y-position of card 100px, per se. πŸ™‚

 

Does this make any sense?  

  • Hi Terp ,

     

    1. First create four cards, divided into two groups: Group A and Group B.

     

    2. Then turn off the following options for each of the cards.

     

     

    3. Create the following measures.

    Diff = SUM('Table'[Exports]) - SUM('Table'[Imports])
    Diff<0 = IF( [Diff] < 0, "#FFFFFF00", "#000000" )
    Diff>0 = IF( [Diff] > 0, "#FFFFFF00", "#000000" )

     

    4. Apply the measure "Diff>0" to the color of the data label and category label of the cards in Group A.

      

     

    5. Apply the measure "Diff<0" to the color of the data label and category label of the cards in Group B.

     

      

     

    6. The final result is as follows:

     

      

     

    If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

    Best Regards,
    Winniz

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

     

     

     

6 Replies

  • Terp's avatar
    Terp
    Advocate III

    ...an example.

     

     

    I am trying to figure out if it's possible to change the Y-location of the two cards on the scale 'plates'...so if the scale flips, the card on the left would be raised while the card on the left lowered.

     

    I call the different images fine, so my question is whether or not I can programatically change the location of the cards based on another field?

  • Terp's avatar
    Terp
    Advocate III

    ...just to add.  One 'workaround' I could do, given how new I am to PowerBI and my lack of DAX mastery, would be to have two bookmarksβ€”one 'right-side high' and one 'left-side high' or whatever.

     

    The issue would be the filtering...user changes the date range, the 'balance' value flips the scale image, then must show the respective bookmark based on the value...have to put more thought into this one for sure, but if anyone has a more elegant solution, love to hear ideas. πŸ™‚

    • v-kkf-msft's avatar
      v-kkf-msft
      Community Support

      Hi Terp ,

       

      1. First create four cards, divided into two groups: Group A and Group B.

       

      2. Then turn off the following options for each of the cards.

       

       

      3. Create the following measures.

      Diff = SUM('Table'[Exports]) - SUM('Table'[Imports])
      Diff<0 = IF( [Diff] < 0, "#FFFFFF00", "#000000" )
      Diff>0 = IF( [Diff] > 0, "#FFFFFF00", "#000000" )

       

      4. Apply the measure "Diff>0" to the color of the data label and category label of the cards in Group A.

        

       

      5. Apply the measure "Diff<0" to the color of the data label and category label of the cards in Group B.

       

        

       

      6. The final result is as follows:

       

        

       

      If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

      Best Regards,
      Winniz

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

       

       

       

    • v-kkf-msft's avatar
      v-kkf-msft
      Community Support

      Hi Terp ,

       

      Has your problem been solved? If it is solved, please mark a reply which is helpful to you.

       

      If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

       

      Best Regards,
      Winniz

      • Terp's avatar
        Terp
        Advocate III

        So so sorry for the delay; the original response was in my 'unfocused' folder and didn't see it, but got it straightened out after I saw the follow-up!

         

        I can't thank you enough, Winniz! While I just saw this and will roll up my sleeves today, this is much more elegant than my bookmark idea and unquestionably will work. Thanks again...awesome idea!

  • Terp's avatar
    Terp
    Advocate III

    This solution works beautifully, Winniz. Thanks again!