Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Discretize Line Chart

Hello there,   I have been trying to split the following line chart into several groups, according to the rangoDeTiempo column. The problem is that whatever I have done keeps mixing all the lines i...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Well, after several days of trying to fix this problem. I took a look at all the functions and thought that I could use the DISTINCT function as a second filter in the CALCULATE function of both, measure 1 and measure 2.

    The result was what I expected. In case someone comes across a similar problem I modified the measures as follow:

    Measure 1:

    YTD Average(Gente) =
    CALCULATE(SUM('Frecuencia'[n.Gente]) /
    (DATEDIFF(MIN('Frecuencia'[fecha]),
    MAX('Frecuencia'[fecha]),
    MONTH) + 1
    ),
    FILTER(ALLSELECTED('Frecuencia'),
    'Frecuencia'[fecha] > MAX('Frecuencia'[fecha]) - 365 &&
    'Frecuencia'[fecha] <= MAX('Frecuencia'[fecha])
    ),
    DISTINCT(Frecuencia[horasDeUsoPromedio])
    )
     
    Measure 2:
    YTD Bajas=
    CALCULATE(
    SUM('Frecuencia'[n.Bajas]),
    FILTER(
    ALLSELECTED('Frecuencia'),
    'Frecuencia'[fecha] > MAX('Frecuencia'[fecha]) - 365 &&
    'Frecuencia'[fecha] <= MAX('Frecuencia'[fecha])
    ),
    DISTINCT(Frecuencia[horasDeUsoPromedio])
    )

    The next plot is the result:
     
    In this case, I am selecting four values to segment the data.