Hello,
I am trying to replicate in DENEB the same dynamic formatting I am applying to my measure in PowerBI. (so thousands with K and millions with MM)
However, my approach is clearly not the right one…
Code used is below, what I am getting out of it is
[object Object]
instead of the numbers.
Can somebody help me understand what I am doing wrong? Thanks!
Kind regards
Valeria
I’ve not seen a condition block used in the format block before. To date, In cases like these, I’ve often used the built-in Vega-Lite formatting (rather than the Power BI formatting) with a stand-alone transformation to create the string I want, then reference that. Vega-Lite is no different that Power BI in that there are often many different ways to accomplish the same thing. Here’s one:
Hello Greg
thanks!!! I actually started like this but my company has very precise requirements - for ex. millions is MM and not M… whereas the s D3 format is not configurable.
My DAX format for the measure is:
SWITCH (
TRUE (),
SELECTEDMEASURE () < 1000, “$#,##0”,
SELECTEDMEASURE () < 1000000, “$#,##0,.0K”,
“$#,##0,.0MM”
)
so I was trying to replicate that…
so you don’t think this is doable in DENEB?
Hi Greg,
this is such a nice solution!!! Thank you so much. I did not know you could add the suffix the way you did - I learned something very useful today
As I was at it, another question came to my mind. Now I have the text of the bars formatted, but the axis is still not formatted the way the company wants.
How would you go for it? I was thinking of using “labelExpr”, but as the formatted text is not a number any longer I get $NaN in the axis… is there a way to accomplish this?
Thanks again for all your help!
Kind regards
Valeria
Hi @valeriabreveglieri. Yup, using labelExpr in the X-axis block is the way to achieve this. For calculations inside the axis, however, instead of the data point, you need to access the axis value, so reference the datum.value. Here’s my implementation:
Thanks Greg!!! I was definitely missing this. Another lesson learned today . Thank you so much for taking the time to answer and teach me!!!
Kind regards
Valeria
we would like to encourage you to create a separate thread for your questions related to this inquiry so that other users can easily check the details of your queries.