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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
crln-blue
Post Patron
Post Patron

Remove blanks in the date column selected from field parameters

Hello!

 

I have a problem with my matrix table.. 

My goal is to create a matrix table, with category as the row and continuous dates as the columns, where the user can select the period of dates to be displayed.  I was able to do this (after 4 hrs lmao) using field parameters from the columns of my date table. This is also my first time in using field parameters and I do admit that I'm not sure if this is the best approach to my goal:

crlnblue_1-1741862363062.png

 

However, as you can see from the screenshot above, there are blanks in the column section. This is because I created columns in my date table to show the Current Month, Current Weak and Current Year. How can I remove the blank? If I exclude it, the slicer will no longer work.

Here's how I created the periods for my field parameters:

crlnblue_2-1741862615683.png

 

Here is my sample pbix: gdrive link

 

Thanks!

2 ACCEPTED SOLUTIONS
danextian
Super User
Super User

Hi @crln-blue 

 

Both Current Mont and Current Week columns doesn't have values for all or rows in Dates Table. You can create a measure that uses the Field Parameter's Order column to switch between calculations while excluding blank category values.

danextian_1-1741866816177.png

Note: Referencing the other Parameter columns will cause an error.

 

Amount  - NonBlank Category Values = 
SWITCH (
    SELECTEDVALUE ( Period[Period Order] ),
    0,
        CALCULATE (
            SUM ( Sheet1[Amounts] ),
            KEEPFILTERS ( NOT ( ISBLANK ( 'Date Table'[Current Week] ) ) )
        ),
    1,
        CALCULATE (
            SUM ( Sheet1[Amounts] ),
            KEEPFILTERS ( NOT ( ISBLANK ( 'Date Table'[Current Month] ) ) )
        ),
    SUM ( Sheet1[Amounts] )
)

 

danextian_2-1741866967653.png

danextian_3-1741866985466.png

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

Vijay_Chethan
Super User
Super User

Hello, here is the solution
i observed u already created table called slicer helper so i used it for solution:
Create a measure :

Measure=
SWITCH(
    SELECTEDVALUE('Slicer Helper'[Slicer Field]),
    "Current Week",
    CALCULATE(
        SUM(Sheet1[Amounts]),
        FILTER(
            'Date Table',
            WEEKNUM('Date Table'[Date], 2) = WEEKNUM(TODAY(), 2)
        )
    ),
    "Current Month",
    CALCULATE(
        SUM(Sheet1[Amounts]),
        FILTER(
            'Date Table',
            MONTH('Date Table'[Date]) = MONTH(TODAY()) && YEAR('Date Table'[Date]) = YEAR(TODAY())
        )
    ),
    "Current Year",
    CALCULATE(
        SUM(Sheet1[Amounts]),
        FILTER(
            'Date Table',
            YEAR('Date Table'[Date]) = YEAR(TODAY())
        )
    )
)

now use Rows : Category
Columns : Date(date table column)-> change formatting accordingly in general section
values : Measure

then for slicer use : slicer helper[slicer filed]


if this helps, please mark as solution

View solution in original post

6 REPLIES 6
Vijay_Chethan
Super User
Super User

Hello, here is the solution
i observed u already created table called slicer helper so i used it for solution:
Create a measure :

Measure=
SWITCH(
    SELECTEDVALUE('Slicer Helper'[Slicer Field]),
    "Current Week",
    CALCULATE(
        SUM(Sheet1[Amounts]),
        FILTER(
            'Date Table',
            WEEKNUM('Date Table'[Date], 2) = WEEKNUM(TODAY(), 2)
        )
    ),
    "Current Month",
    CALCULATE(
        SUM(Sheet1[Amounts]),
        FILTER(
            'Date Table',
            MONTH('Date Table'[Date]) = MONTH(TODAY()) && YEAR('Date Table'[Date]) = YEAR(TODAY())
        )
    ),
    "Current Year",
    CALCULATE(
        SUM(Sheet1[Amounts]),
        FILTER(
            'Date Table',
            YEAR('Date Table'[Date]) = YEAR(TODAY())
        )
    )
)

now use Rows : Category
Columns : Date(date table column)-> change formatting accordingly in general section
values : Measure

then for slicer use : slicer helper[slicer filed]


if this helps, please mark as solution

Thank you for this! Initially, the slicer helper is for the measure creation similar to yours. But I was focusing on removing the dates itself (and when I did, it removed the row data) and so I tried to do the field parameter approach.

 

Still, thank you for this! This approach works perfectly too!

here you worldnt need current month,week , year columns as well

 

danextian
Super User
Super User

Hi @crln-blue 

 

Both Current Mont and Current Week columns doesn't have values for all or rows in Dates Table. You can create a measure that uses the Field Parameter's Order column to switch between calculations while excluding blank category values.

danextian_1-1741866816177.png

Note: Referencing the other Parameter columns will cause an error.

 

Amount  - NonBlank Category Values = 
SWITCH (
    SELECTEDVALUE ( Period[Period Order] ),
    0,
        CALCULATE (
            SUM ( Sheet1[Amounts] ),
            KEEPFILTERS ( NOT ( ISBLANK ( 'Date Table'[Current Week] ) ) )
        ),
    1,
        CALCULATE (
            SUM ( Sheet1[Amounts] ),
            KEEPFILTERS ( NOT ( ISBLANK ( 'Date Table'[Current Month] ) ) )
        ),
    SUM ( Sheet1[Amounts] )
)

 

danextian_2-1741866967653.png

danextian_3-1741866985466.png

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Thank you! I applied this and didn't realize KEEPFILTERS is the syntax I should be using all along. Thank you again!

johnt75
Super User
Super User

Another approach is to create a new table which contains the period and the relevant dates. You can use

Date Period Slicer =
VAR CurrentYear =
    ADDCOLUMNS (
        CALENDAR (
            DATE ( YEAR ( TODAY () ), 1, 1 ),
            DATE ( YEAR ( TODAY () ), 12, 31 )
        ),
        "Period", "Current Year"
    )
VAR CurrentMonth =
    ADDCOLUMNS (
        CALENDAR (
            DATE ( YEAR ( TODAY () ), MONTH ( TODAY () ), 1 ),
            EOMONTH ( TODAY (), 0 )
        ),
        "Period", "Current Month"
    )
VAR StartWeek =
    TODAY () - WEEKDAY ( TODAY (), 1 ) + 1
VAR CurrentWeek =
    ADDCOLUMNS ( CALENDAR ( StartWeek, StartWeek + 6 ), "Period", "Current Week" )
VAR Result =
    UNION ( CurrentYear, CurrentMonth, CurrentWeek )
RETURN
    Result

Link this to your date table in a many-to-many single direction relationship so that 'Date Period Slicer' filters 'Date'.

Use columns from your date table in any visuals, but use the period column from the new table in the slicer.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors