2
votes

I have a query that I call "cuartil" which I want to work as an axis. If I put it in a table it would show like this:

enter image description here

then this measure may vary according to the region filter that is made, as for example in this image:

enter image description here

but I want to show it in a graph, in which I would like to use the measure as an axis, but the power bi does not allow me to use it as such

Will there be any way to put a measure as an axis?

To obtain the "cuartil" measure, first calculate the UniqueRank:

UniqueRank = 
RANKX (
  tabla_ranking;
  FORMAT ( tabla_ranking[nro_trabajos]; "0000" ) & tabla_ranking[region] & 
tabla_ranking[site]
)

then I calculate the measure ranking2:

ranking2 = 
RANKX (
   ALLSELECTED ( tabla_ranking );
   tabla_ranking[UniqueRank];
   MAX ( tabla_ranking[UniqueRank] )
)

and finally calculate the measure "cuartil"

  cuartil = IF(tabla_ranking[ranking2]<= 
    [total_registros]*0.25;"1P";IF(tabla_ranking[ranking2]<= 
    [total_registros]*0.5;"2P";IF(tabla_ranking[ranking2]<= 
    [total_registros]*0.75;"3P";"4P")))
1

1 Answers

1
votes

You can't use a measure for an axis. However, if cuartil is not dependent on a slicer or any dynamic filtering, then you can create a calculated column using the measure and use the calculated column for your axis.


To use cuartil on an axis, create a new table Axis with the column:

cuartil
----
1P
2P
3P
4P

Then you can write measures to use for your graph. For example,

numero trabajos = 
CALCULATE (
    SUM ( tabla_ranking[nro_trabajos] ),
    FILTER ( tabla_ranking, [cuartil] IN VALUES ( Axis[cuartil] ) )
)