Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
MR2018
Regular Visitor

Bar chart with a measure as legend/segmentation

Hello!

I have to plot a bar chart with a segmentation which depends on a date slicer.

 

Use case

Data columns:

user := the user name

step_id := the step id (the total of steps is 5 and it had to be through in order from 1 to 5)

date := the date when the step was finished

 

Given a date slicer, a bar chart with the following characteristics has to be plotted:

- The X-axis represents the 5 steps that users have to go through (in order)

- The Y-axis represents the total of users in each step for the selected dates

- The segmentation in each bar, has to show which of these step is the first of the user for the selected dates

 

Example

userstep_iddate
Daniel101/01/2023
Daniel202/01/2023
Laura102/01/2023
Laura203/01/2023

 

If date slicer is  ( 01/01/2023  - 02/01/2023 )

Step_1

# First steps = 2 (the step 1 is the first for both users in date range)

# Not first steps = 0

Step_2

# First steps = 0

# Not first steps = 1 (the step 2 is Daniel's second step in date range) - Laura's step 2 is out of the date range

 

If date slicer is  ( 02/01/2023  - 03/01/2023 )

Step_1

# First steps = 1 (the step 1 is Laura's first step in date range) - Daniel's step 1 is out of range

# Not first steps = 0

Step_2

# First steps = 1 (the step 2 is Daniel's first step in date range)

# Not first steps = 1 (the step 2 is Laura's second step in date range)

 

Problem

I have created the measure that calculates if each step is the first or not in the date range for each user, but I cannot use this measure in a bar chart as the legend in order to make the segmentation.

 

Any idea how can I do it?

 

At the end I attach some photos of my report and data as I am not able to publish the .pbix (sorry but I am new here in forum 😅)

 

-------------------------------------------------------------------------------------------------

Hola!

Tengo que representar un gráfico de barras con una segmentación de datos basada en un filtro de fechas

 

Caso de uso

Columnas:

user := nombre del usuario

step_id := el id del paso (el total de pasos es 5 y los usuarios los tienen que ir recorriendolos en orden del 1 al 5)

date := la fecha cuando se cumple cada paso

 

Dado un filtro/segmentación de fechas, se tiene que representar una gráfica de barras con las siguientes características:

- Eje X: representa los 5 pasos por los que tienen que pasar los usuarios (en orden)

- Eje Y: representa el total de usuarios en cada paso para las fechas seleccionadas

- La segmentación en cada barra tiene que mostrar cuántos de esos pasos son el primero de un usuario en las fechas seleccionadas.

 

Ejemplo

userstep_iddate
Daniel101/01/2023
Daniel202/01/2023
Laura102/01/2023
Laura203/01/2023

 

Si el filtro de fechas es ( 01/01/2023  - 02/01/2023 )

Paso_1

# Primeros pasos = 2 (el paso 1 es el primero para ambos usuarios en el rango de fechas)

# No primeros pasos = 0

Paso_2

# Primeros pasos = 0

# No primeros pasos = 1 (el paso 2 es el segundo paso de Daniel en el rango de fechas) - El paso 2 de Laura está fuera del rango de fechas

 

Si el filtro de fechas es ( 02/01/2023  - 03/01/2023 )

Paso_1

# Primeros pasos = 1 (el paso 1 es el primer paso de Laura en el rango de fechas) - El paso 1 de Daniel está fuera del rango

# No primeros pasos = 0

Paso_2

# Primeros pasos = 1 (el paso 2 es el primer paso de Daniel en el rango de fechas)

# No primeros pasos = 1 (el paso 2 es el segundo paso de Laura en el rango de fechas)

 

Problema

He creado la medida que calcula si cada paso es el primero o no en el rango de fechas para cada usuario, pero no puedo utilizar esta medida en un gráfico de barras como leyenda para poder hacer la segmentación.

 

¿Alguna idea de cómo puedo hacerlo?

 

Adjunto varias fotos con un ejemplo más completo y los problemas que he encontrado

(lo siento pero soy nueva en el foro y no consigo publicar el fichero .pbix 😅)

 

-----------------------------------------------------------------------------------------------

 

- Source data / Datos de origen

MR2018_1-1695819176587.png

 

- Filtered data with the measure shown in a table / Datos filtrados con la medida incluida mostrados en tabla

MR2018_2-1695819299659.png

 

- Expected result / Resultado esperado

MR2018_3-1695819403952.png

 

- Problem with default "Stacked column chart" / Problema con la visualización predeterminada de "Gráfico de barras apiladas"

Captura de pantalla 2023-09-27 145932.png

 

- Problem with other market visualization / Problema con otra visualización

Captura de pantalla 2023-09-27 150345.png

 - Measures / Medidas:

MinStep =
CALCULATE(
    MIN( funnel_data[step_id] ),
    FILTER(
        ALLSELECTED(funnel_data) ,
        COUNTROWS( FILTER( funnel_data, EARLIER( funnel_data[step_id] ) <= funnel_data[step_id] && EARLIER( funnel_data[user] ) == funnel_data[user] ) )  
    )
)

 

isFirstStep = CALCULATE(if(SELECTEDVALUE(funnel_data[step_id]) = [MinStep], "First", "NotFirst")) 

 
Thank you! / ¡Gracias!

1 REPLY 1
lbendlin
Super User
Super User

Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot). Leave out anything not related to the issue.
If you are unsure how to do that please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.

If you want to get answers faster please refer to https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.