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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

Seleccione dinámicamente el mes pasado en el gráfico de barras

Hola

Tengo un gráfico de barras en Power BI y estoy tratando de mantener dinámicamente seleccionado el correspoding de barras al mes pasado. La intención es mostrar los números de otras métricas basadas en el mes pasado y también dar la opción de seleccionar barras correspondientes a otros meses si el usuario desea ver específicamente para cualquier mes. ¿Es esto posible?

Dilpreeth_0-1598445407456.png

1 ACCEPTED SOLUTION
v-xuding-msft
Community Support
Community Support

Hola @Dilpreeth ,

Por favor, intente esto:

Una tabla desconectada:

Date = CALENDAR(MIN('Table'[Date]),MAX('Table'[Date]))

Medidas:

Total sales =
VAR selectedsales =
    CALCULATE (
        SUM ( 'Table'[Sales] ),
        FILTER (
            'Table',
            'Table'[Date].[Month] = SELECTEDVALUE ( 'Date'[Date].[Month] )
        )
    )
RETURN
    IF (
        ISFILTERED ( 'Date'[Date].[Month] ),
        selectedsales,
        CALCULATE ( SUM ( 'Table'[Sales] ) )
    )

Measure =
VAR maxdate =
    MAXX ( ALL ( 'Table' ), 'Table'[Date] )
RETURN
    IF (
        ISFILTERED ( 'Date'[Date].[Month] ),
        "Blue",
        IF ( MAX ( 'Table'[Date] ) = maxdate, "Blue", "Gray" )
    )

highlight bars by default.gif

Puede hacer referencia al documento para obtener más información sobre el formato condicional y cambiar otros colores en la fórmula.

https://docs.microsoft.com/en-us/power-bi/create-reports/desktop-conditional-table-formatting#color-...

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Gracias @amitchandak @v-xuding-msft ... apreciar la ayuda

v-xuding-msft
Community Support
Community Support

Hola @Dilpreeth ,

Por favor, intente esto:

Una tabla desconectada:

Date = CALENDAR(MIN('Table'[Date]),MAX('Table'[Date]))

Medidas:

Total sales =
VAR selectedsales =
    CALCULATE (
        SUM ( 'Table'[Sales] ),
        FILTER (
            'Table',
            'Table'[Date].[Month] = SELECTEDVALUE ( 'Date'[Date].[Month] )
        )
    )
RETURN
    IF (
        ISFILTERED ( 'Date'[Date].[Month] ),
        selectedsales,
        CALCULATE ( SUM ( 'Table'[Sales] ) )
    )

Measure =
VAR maxdate =
    MAXX ( ALL ( 'Table' ), 'Table'[Date] )
RETURN
    IF (
        ISFILTERED ( 'Date'[Date].[Month] ),
        "Blue",
        IF ( MAX ( 'Table'[Date] ) = maxdate, "Blue", "Gray" )
    )

highlight bars by default.gif

Puede hacer referencia al documento para obtener más información sobre el formato condicional y cambiar otros colores en la fórmula.

https://docs.microsoft.com/en-us/power-bi/create-reports/desktop-conditional-table-formatting#color-...

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amitchandak
Super User
Super User

@Dilpreeth, con una sola medida debería poder hacer formato condicional. puedes crear una medida como esta

Ejemplo

Color Date á if(FIRSTNONBLANK('Date'[Date],TODAY()) <today(),"lightgreen","red")

A continuación, úselo en formato condicional

https://radacad.com/dax-and-conditional-formatting-better-together-find-the-biggest-and-smallest-num...
https://docs.microsoft.com/en-us/power-bi/desktop-conditional-table-formatting#color-by-color-values

Si el formato condicional no está disponible en la etiqueta de datos. tratar de algo como esto para poner un punto

https://community.powerbi.com/t5/Community-Blog/Display-Label-Only-on-the-Last-Data-Point-of-the-Lin...

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors