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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

SELECTECTVALUE not working fine.

TRPD_Daniel_1-1702997521350.png

 

This one have 3 cards with 3 different measures.
The first one is :

Qtd Total Current Month =
CALCULATE(
    SUM(LinhasEncomendas_BI[partes]),
    MONTH(LinhasEncomendas_BI[DataFinal]) =
    IF(ISBLANK(SELECTEDVALUE(LinhasEncomendas_BI[DataFinal].[MonthNo])), MONTH(TODAY()),SELECTEDVALUE(LinhasEncomendas_BI[DataFinal].[MonthNo]))
)

The second one is:
Qtd Total Previous Month =
CALCULATE(
    SUM(LinhasEncomendas_BI[partes]),
    MONTH(LinhasEncomendas_BI[DataFinal]) =
    IF(ISBLANK(SELECTEDVALUE(LinhasEncomendas_BI[DataFinal].[MonthNo])), MONTH(EDATE(TODAY(), -1)),MONTH(EDATE(SELECTEDVALUE(LinhasEncomendas_BI[DataFinal].[Date]), -1)))
)

The third one is: 
Qtd Total Month Before =
CALCULATE(
    SUM(LinhasEncomendas_BI[partes]),
    MONTH(LinhasEncomendas_BI[DataFinal]) =
    IF(ISBLANK(SELECTEDVALUE(LinhasEncomendas_BI[DataFinal].[MonthNo])), MONTH(EDATE(TODAY(), -2)),SELECTEDVALUE(LinhasEncomendas_BI[DataFinal].[MonthNo])-2)
)

The slicer contais LinhasEncomendas_BI[DataFinal] with year and month, when its nothing selected the 3 cards shows the actual month and the last 2 months, but when I select for example July they have to change to July - June - May. But itsn't working like I should. Can someone try to help me ?
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous 

You can refer to the following measure

Qtd Total Current Month =
CALCULATE (
    SUM ( LinhasEncomendas_BI[partes] ),
    MONTH ( LinhasEncomendas_BI[DataFinal] )
        = IF (
            ISBLANK ( SELECTEDVALUE ( LinhasEncomendas_BI[DataFinal].[MonthNo] ) ),
            MONTH ( TODAY () ),
            SELECTEDVALUE ( LinhasEncomendas_BI[DataFinal].[MonthNo] )
        ),
    ALL ( LinhasEncomendas_BI )
)
Qtd Total Previous Month =
CALCULATE (
    SUM ( LinhasEncomendas_BI[partes] ),
    MONTH ( LinhasEncomendas_BI[DataFinal] )
        = IF (
            ISBLANK ( SELECTEDVALUE ( LinhasEncomendas_BI[DataFinal].[MonthNo] ) ),
            MONTH ( EDATE ( TODAY (), -1 ) ),
            MONTH ( EDATE ( SELECTEDVALUE ( LinhasEncomendas_BI[DataFinal].[Date] ), -1 ) )
        ),
    ALL ( LinhasEncomendas_BI )
)
Qtd Total Previous Month =
CALCULATE (
    SUM ( LinhasEncomendas_BI[partes] ),
    MONTH ( LinhasEncomendas_BI[DataFinal] )
        = IF (
            ISBLANK ( SELECTEDVALUE ( LinhasEncomendas_BI[DataFinal].[MonthNo] ) ),
            MONTH ( EDATE ( TODAY (), -2 ) ),
            MONTH ( EDATE ( SELECTEDVALUE ( LinhasEncomendas_BI[DataFinal].[Date] ), -2 ) )
        ),
    ALL ( LinhasEncomendas_BI )
)

Best Regards!

Yolo Zhu

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

2 REPLIES 2
Anonymous
Not applicable

Thats works like I want too, thanks for the help 😄

Anonymous
Not applicable

Hi @Anonymous 

You can refer to the following measure

Qtd Total Current Month =
CALCULATE (
    SUM ( LinhasEncomendas_BI[partes] ),
    MONTH ( LinhasEncomendas_BI[DataFinal] )
        = IF (
            ISBLANK ( SELECTEDVALUE ( LinhasEncomendas_BI[DataFinal].[MonthNo] ) ),
            MONTH ( TODAY () ),
            SELECTEDVALUE ( LinhasEncomendas_BI[DataFinal].[MonthNo] )
        ),
    ALL ( LinhasEncomendas_BI )
)
Qtd Total Previous Month =
CALCULATE (
    SUM ( LinhasEncomendas_BI[partes] ),
    MONTH ( LinhasEncomendas_BI[DataFinal] )
        = IF (
            ISBLANK ( SELECTEDVALUE ( LinhasEncomendas_BI[DataFinal].[MonthNo] ) ),
            MONTH ( EDATE ( TODAY (), -1 ) ),
            MONTH ( EDATE ( SELECTEDVALUE ( LinhasEncomendas_BI[DataFinal].[Date] ), -1 ) )
        ),
    ALL ( LinhasEncomendas_BI )
)
Qtd Total Previous Month =
CALCULATE (
    SUM ( LinhasEncomendas_BI[partes] ),
    MONTH ( LinhasEncomendas_BI[DataFinal] )
        = IF (
            ISBLANK ( SELECTEDVALUE ( LinhasEncomendas_BI[DataFinal].[MonthNo] ) ),
            MONTH ( EDATE ( TODAY (), -2 ) ),
            MONTH ( EDATE ( SELECTEDVALUE ( LinhasEncomendas_BI[DataFinal].[Date] ), -2 ) )
        ),
    ALL ( LinhasEncomendas_BI )
)

Best Regards!

Yolo Zhu

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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.