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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply

Incorect values YTD and PREVIOUSMONTH when applying SELECTCOLUMNS

Looks like row context is working when applying SELECTCOLUMNS.  Expected values are placed in the full table 2022

 

gerardotrejogcg_0-1662752535642.png

This is the DAX sintax of above one row table - that is wrong.   I'm using SELECTCOLUMNS because I need to UNION similar calculations with other variables.

 

Monthly Scorecard =
SELECTCOLUMNS (
    'Ruta Corta',
    "ID", 1,
    "Fecha", 'Ruta Corta'[Fecha Ruta],
    "L1", "VOLUME",
    "L2", "Production",
    "UoM", "Lts/Day",
    "Target", "140,000",
    "YTD", TOTALYTD ( [Lts Average] , Fecha[Fecha] ), --[Lts Average YTD],
    "M-2",
        CALCULATE (
            [Lts Average],
            PREVIOUSMONTH ( PREVIOUSMONTH ( 'Ruta Corta'[Fecha Ruta] ) )
        ),
    "M-1",
        CALCULATE (
            [Lts Average],
            PREVIOUSMONTH ( 'Ruta Corta'[Fecha Ruta] )
        ),
    "M", [Lts Average]
)

 

1 REPLY 1
amitchandak
Super User
Super User

@gerardotrejogcg , If you are creating a table, this will not take slicer values.

PREVIOUSMONTH works on first date available in the calendar 

datesytd (datesqtd, datesmtd, totalytd) use the last available date in the calendar. That will give you your results

 

If the table is used as a var in the measure it can work

 

Why previousmonth does not give result when datesmtd is giving it: https://youtu.be/1KkoJehRVeg

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors