Forum Discussion

ivancespedesl's avatar
7 years ago
Solved

Changing column graph displayed value and getting measures out of it

Hi,

I want to get a "macro-graph" where I have all the variables inside it. I did it creating a new table ('Value') following this formula:

 

Measure =
IF(HASONEVALUE( 'Value'[Value]),
SWITCH(VALUES('Value'[Value]),
"Ingresos_Mes", AVERAGE('Clientes Mac'[Ingresos_Mes]),
"Sal_Cons_TC", SUM( 'Clientes Mac'[Sal_Cons_TC] ),
"Sal_Cons_CC", SUM( 'Clientes Mac'[Sal_Cons_CC])
), "Choose a value")


However, now I want to make measures out of this measure such as MoM%, Average over time, etc. Mostly time intelligence measures. The measure really doesnt understand time, or maybe my formula is wrong. For example, MoM% is the following:

MoM% =
IF(
    ISFILTERED('Clientes Mac'[Date].[Month]),
    ERROR("Time intelligence quick measures can only be grouped or filtered by the Power BI-provided date hierarchy or primary date column."),
    VAR __PREV_MONTH = CALCULATE([Measure], DATEADD('Clientes Mac'[Date].[Date], -1, MONTH))
    RETURN
        DIVIDE([Measure] - __PREV_MONTH, __PREV_MONTH)
)

Any suggestions are accepted.
 
 
Thanks in advance,
 
IC
  • v-lili6-msft's avatar
    v-lili6-msft
    7 years ago

    hi, ivancespedesl 

    The problem is that there is no row context in this visual. So it could understand the time variables.

    So .could you please share a simple sample data and your expected output. so that I could give you a further help.

     

    Best Regards,

    Lin

     

3 Replies

    • ivancespedesl's avatar
      ivancespedesl
      Icon for Helper I rankHelper I

      Hi,

       

      Using this code I was able to create a variable that gives me this output:

      This allows me to get the totals and graphs depending on the selection as I want to be presented:

       

      However, Im having problem making measures as Average, MoM%, etc. I think the problem is that it does not understand the time variables, therefore, does not calculate properly.

       

      What I want to do is to create measures as Average, MoM% that work for every variable selected so I want to do this calculations specifically to the variable Measure.

       

      Any other info you need, Im at your service.

      • v-lili6-msft's avatar
        v-lili6-msft
        Icon for Community Support rankCommunity Support

        hi, ivancespedesl 

        The problem is that there is no row context in this visual. So it could understand the time variables.

        So .could you please share a simple sample data and your expected output. so that I could give you a further help.

         

        Best Regards,

        Lin