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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
MacJasem
Helper II
Helper II

Card visual should not be affected by chosen values in the Month Filter, but that's not easy?

Hi Guys

I have created this Dax calculated Date Table:

DateTable =

VAR MaxDate = TODAY()

VAR CalendarTable = CALENDAR(DATE(2022, 1, 1), MaxDate)

RETURN

    ADDCOLUMNS (

        CalendarTable,

        "DateText", FORMAT([Date], "ddmmyyyy"),

        "Year", YEAR([Date]),

        "Week", WEEKNUM([Date], 21),

        "Month", FORMAT([Date], "mmmm"),

        "Month No.”, MONTH([Date]),

        "Quarter", FORMAT([Date], "\QQ"),

        "YTD", IF(YEAR([Date]) = YEAR(MaxDate), 1, 0),

        "Today", IF([Date] = MaxDate, 1, 0),

        "MonthYear", FORMAT([Date], "mm-yyyy"),

        "CurrentYear",

        IF(

            YEAR([Date]) = YEAR(MaxDate),

            "CurrentYear",

            FORMAT(YEAR([Date]), "0")

        ),

        "CurrentMonth",

        IF(

            MONTH([Date]) = MONTH(MaxDate),

            "CurrentMonth",

            FORMAT([Date], "MMM")

        ),

        "ClosedDates",

        IF(

            LOOKUPVALUE('Finance'[DateClosed], 'Finance'[Date], [Date]) = TRUE(),

            FORMAT([Date], "MMMM"),

            BLANK()

        ),

        "Sort By",

        IF(

            LOOKUPVALUE('Finance'[DateClosed], 'Finance'[Date], [Date]) = TRUE(),

            FORMAT([Date], "MM-YYYY"),

            ""

        ),

        "Index",

        RANKX(FILTER(CalendarTable, [Date] <= EOMONTH(MaxDate, -2)), [Date], , ASC, Dense)

    )



And another Dax calculated Date table, which is;

 

 

DateTableFilter =

VAR MaxDate = TODAY()

VAR CalendarTable = CALENDAR(DATE(2022, 1, 1), MaxDate)

RETURN

    ADDCOLUMNS (

        FILTER(CalendarTable,

            NOT(ISBLANK(

                LOOKUPVALUE('Finance'[DateClosed], 'Finance'[Date], [Date])

            )) &&

            LOOKUPVALUE('Finance'[DateClosed], 'Finance'[Date], [Date]) <> FALSE()

        ),

        "DateText", FORMAT([Date], "ddmmyyyy"),

        "Year", YEAR([Date]),

        "Week", WEEKNUM([Date], 21),

        "Month", FORMAT([Date], "mmmm"),

        "Month No.", MONTH([Date]),

        "Quater", FORMAT([Date], "\QQ"),

        "YTD", IF(YEAR([Date]) = YEAR(MaxDate), 1, 0),

        "Today", IF([Date] = MaxDate, 1, 0),

        "Monthyear", FORMAT([Date], "mm-yyyy"),

        "CurrentYear",

        IF(

            YEAR([Date]) = YEAR(MaxDate),

            "CurrentYear",

            FORMAT(YEAR([Date]), "0")

        ),

        "ClosedDates",

        FORMAT([Date], "MMMM"),

        "Sort By",

        FORMAT([Date], "MM-YYYY"),

        "Index",

        RANKX(FILTER(CalendarTable, [Date] <= EOMONTH(MaxDate, -2)), [Date], , ASC, Dense)

    )

 

The tables have the following relationships:

DateTableFilter (1-to-Many) -> DateTable

DateTable (1-to-Many) -> Finance


in the DateTableFilter table I have a measure;

ClosedDatesNoFilter =

MAXX(

    VALUES(DateTableFilter[ClosedDates]),

    DateTableFilter[ClosedDates]

)

 

This measure I’d like to use for a Card visual on a report page. Though the measure returns the correct value, but on the same page I have a month filter made up of the ClosedDates column in the same table, and when a value is selected in the month filter the Card value changes accordingly which is not what I’m wishing for. I’ve even tried removing the interaction between the month filter [ClosedDates] and the Card visual [ClosedDatesNoFilter] but that just messes with the Card value, and returns another date than expected.

What am I missing or doing wrong here?

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

Use measures to modify (or circumvent) filter context.  Read about ALL, ALLSELECTED, REMOVEFILTERS etc.

View solution in original post

4 REPLIES 4
MacJasem
Helper II
Helper II

I found a work around that does the work, eventhough i'd rather understand why the right way didn't work 😁

But thanks for the help @lbendlin 🙏 

lbendlin
Super User
Super User

Use measures to modify (or circumvent) filter context.  Read about ALL, ALLSELECTED, REMOVEFILTERS etc.

I tried that but it didn't work as expected. I might be doing something wrong 🤷‍♂️😊

Are you able to provide a sample PBIX that illustrates the issue?

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.