Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

Measure in Axie

Hello, everybody!! 

 

I'm working on a graph where I have to show the number of active or inactive customers. To define what is active or inactive, I have to calculate the last purchase date of that customer minus today's date. However, when filtering other years in the segmentation, such as 2021 or 2019, I have to make the date of the last purchase minus "31/12" of that filtered year.

The problem is, putting this measure, where I would use the selectedvalue, on the X axis. 

 

Can anybody help me? 

 

THIS IS THE MEASURE THAT IM USING

active-inactive = IF( AND (SELECTEDVALUE(Consulta1[YEAR OF SALE]) = 2019, VALUES(year[last date year])-VALUES(CLIENTES[last purchase date]) <=12),"ACTIVE",IF( AND (SELECTEDVALUE(Consulta1[YEAR OF SALE]) = 2020, VALUES(year[last date year])-VALUES(CLIENTES[last purchase date]) <=12),"ACTIVE",IF( AND (SELECTEDVALUE(Consulta1[YEAR OF SALE]) = 2021, VALUES(year[last date year])-VALUES(CLIENTES[last purchase date]) <=12),"ACTIVE"IF( AND (SELECTEDVALUE(Consulta1[YEAR OF SALE]) = 2022, NOW()-VALUES(CLIENTES[last purchase date]) <=12),"ACTIVE","INACTIVO"))))

THIS IS THE CHART

THE LEGEND IS THE GENRE OF CUSTOMERS,

THE VALUES, IS THE AMOUT OF CUSTOMERS 

AND I WANT TO ADD THIS MEASURES IN THE AXIS

 

TKSS

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous,

    Current power bi does not support to use measure expression as axis or category, you need to use the value column instead. (notice: calculate column can't be dynamic change based on filter effects)

    Notice: the data level of power bi.

    Database(external) -> query table(query, custom function, query parameters) -> data model table(table, calculate column/table) -> data view with virtual tables(measure, visual, filter, slicer)

    Regards,

    Xiaoxin Sheng