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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
ArquimedesP
Helper II
Helper II

Show measure values till the month selected

Hi! I'm having real bad time to cumplish this. I have two tables,  VW_Fecha and VW_Indicadores_Gestion. Both are disconected from each other. Then I have this measures:

1) KPI_CR_Ano = 

                VAR Anio  =

                VAR Anio_Hoy = YEAR(TODAY())
                RETURN
                 IF(NOT(ISFILTERED(VW_Fecha[Anio_Nu])),Anio_Hoy,SELECTEDVALUE(VW_Fecha[Anio_Nu]))
2) 
KPI_CR_Mes =
                VAR Mes_Hoy= MONTH(TODAY())
                RETURN
                COALESCE(VALUE(SELECTEDVALUE(VW_Fecha[Mes_Nu])),Mes_Hoy)

3) 
KPI_CR_MOV_SA =
                 VAR Ano=[KPI_CR_Ano]
                 VAR Mes=[KPI_CR_Mes]
                 VAR C = 1
                 VAR IF_SA=CALCULATE(SUM(VW_Indicadores_Gestion[Movimiento_Neto]),VW_Indicadores_Gestion[Grupo_Padre]      ="Ingresos Financieros",VW_Indicadores_Gestion[Agrupador_Cuenta_De]<>"Ingresos Financieros AxI",VW_Indicadores_Gestion[Anio_Valor_Contable]=Ano,VW_Indicadores_Gestion[Mes_Valor_Contable]=Mes)
                  RETURN
                  IF_SA
I show the results in a Bar chart visual where in X's axis I have [Mes-Anio] and Y's axis I have [KPI_CR_MOV_SA]. I also have Year selector (fromVW_Fecha) and Month selector (fromVW_Fecha). 

 
My issue is:  I want to show in the Bar chart visual the result of the measure till the month selected. How can I accomplish this only with this two table (I don't want to use calendar date table)?
 
Thanks! 
1 ACCEPTED SOLUTION
DataNinja777
Super User
Super User

Hi @ArquimedesP ,

 

In order to sever the filtering coming from the slicer and from your Y-axis on your bar chart, you need to create separate disconnected tables for the slicer and Y-axis for the calendar data.  

Then, you can write a measure like below:

Movement for Chart = 
VAR SelectedYear =
    SELECTEDVALUE( YearSelector[Anio_Valor_Contable] )

VAR SelectedMonthCutoff =
    SELECTEDVALUE( MonthSelector[MonthNumberSel] )

-- The bar's own Year and Month coming from the axis table VW_Fecha
VAR ThisYear  = MAX( VW_Fecha[Anio_Nu] )
VAR ThisMonth = MAX( VW_Fecha[Mes_Nu] )

-- Build a YYYYMM key for cutoff and this bar
VAR CutoffKey = SelectedYear * 100 + SelectedMonthCutoff
VAR ThisKey   = ThisYear     * 100 + ThisMonth

RETURN
IF(
    NOT ISBLANK(SelectedYear)
    && NOT ISBLANK(SelectedMonthCutoff)
    && ThisKey <= CutoffKey,

    CALCULATE(
        SUM( VW_Indicadores_Gestion[Movimiento_Neto] ),
        FILTER(
            VW_Indicadores_Gestion,
            VW_Indicadores_Gestion[Anio_Valor_Contable] = ThisYear
            && VW_Indicadores_Gestion[Mes_Valor_Contable] = ThisMonth
            && VW_Indicadores_Gestion[Grupo_Padre] = "Ingresos Financieros"
            && VW_Indicadores_Gestion[Agrupador_Cuenta_De] <> "Ingresos Financieros AxI"
        )
    )
)

And put that measure and disconnected dimension tables fields in the visual like below:

DataNinja777_1-1762098702921.png

 

I have attached an example pbix file for your reference.

 

Best regards,

 

 

View solution in original post

5 REPLIES 5
parry2k
Super User
Super User

@ArquimedesP have you tried the measure I provided? It will be easier if you share pbix file using one drive/google drive with the expected output. Remove any sensitive information before sharing.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

I used DataNinja777 formula as a reference and modified it and it worked. I also used a calendar table so I can use it as a Year-Month filter. Thanks to all. 

DataNinja777
Super User
Super User

Hi @ArquimedesP ,

 

In order to sever the filtering coming from the slicer and from your Y-axis on your bar chart, you need to create separate disconnected tables for the slicer and Y-axis for the calendar data.  

Then, you can write a measure like below:

Movement for Chart = 
VAR SelectedYear =
    SELECTEDVALUE( YearSelector[Anio_Valor_Contable] )

VAR SelectedMonthCutoff =
    SELECTEDVALUE( MonthSelector[MonthNumberSel] )

-- The bar's own Year and Month coming from the axis table VW_Fecha
VAR ThisYear  = MAX( VW_Fecha[Anio_Nu] )
VAR ThisMonth = MAX( VW_Fecha[Mes_Nu] )

-- Build a YYYYMM key for cutoff and this bar
VAR CutoffKey = SelectedYear * 100 + SelectedMonthCutoff
VAR ThisKey   = ThisYear     * 100 + ThisMonth

RETURN
IF(
    NOT ISBLANK(SelectedYear)
    && NOT ISBLANK(SelectedMonthCutoff)
    && ThisKey <= CutoffKey,

    CALCULATE(
        SUM( VW_Indicadores_Gestion[Movimiento_Neto] ),
        FILTER(
            VW_Indicadores_Gestion,
            VW_Indicadores_Gestion[Anio_Valor_Contable] = ThisYear
            && VW_Indicadores_Gestion[Mes_Valor_Contable] = ThisMonth
            && VW_Indicadores_Gestion[Grupo_Padre] = "Ingresos Financieros"
            && VW_Indicadores_Gestion[Agrupador_Cuenta_De] <> "Ingresos Financieros AxI"
        )
    )
)

And put that measure and disconnected dimension tables fields in the visual like below:

DataNinja777_1-1762098702921.png

 

I have attached an example pbix file for your reference.

 

Best regards,

 

 

Thanks but didn't work! The measure already calculate the value for each month. Maybe I need a new approach and use calendar table but them I'll have to recalculate everything!😪

parry2k
Super User
Super User

@ArquimedesP Not sure why you don't want to use the calendar table. Anyhow, this is what I will try:

 

//add new column in VW_Indicadores_Gestion table
Date Column = EOMONTH ( DATE ( VW_Indicadores_Gestion [Year Column], VW_Indicadores_Gestion [Month Column], 1 ), 0 )

KPI_CR_MOV_SA =
VAR Ano = [KPI_CR_Ano]
VAR Mes = [KPI_CR_Mes]
VAR MyDate =
    EOMONTH ( DATE ( [Ano], [Mes], 1 ), 0 )
VAR C = 1
VAR IF_SA =
    CALCULATE (
        SUM ( VW_Indicadores_Gestion[Movimiento_Neto] ),
        VW_Indicadores_Gestion[Grupo_Padre] = "Ingresos Financieros",
        VW_Indicadores_Gestion[Agrupador_Cuenta_De] <> "Ingresos Financieros AxI",
        VW_Indicadores_Gestion[New Date Column] <= MyDate
    )
RETURN
    IF_SA


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.