cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

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
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

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

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors