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
GM_AUS
Regular Visitor

Matrix showing only Future Months

Hi!

 

Here is the link to Fake Data and Report https://drive.google.com/drive/folders/12psHWMA2tbSyAyZoTj90OOZnl49_qOck?usp=sharing 

 

On my report I have a matrix and I would like to show the columns for future months only, and even if they have no values in it.

 

For instance, if we are in May 2022, I would like the matrix to show only the columns starting with May 2022 onwards. I don't want to see the column for January, February, March and April 2022.

 

However, I would like to be able to see values for January, February, March and April 2023 (next year), but I don't want to group the values of 2022 with 2023. I want to be able to see them separately.

 

This is what I have now:

 

GM_AUS_0-1651639234209.png

This is what I would like to see:

GM_AUS_1-1651639497569.png

 

I managed to do it by hiding the columns manually (Visualizations Pane >> Visual >> Column Headers >> Text >> Text Wrap OFF.

 

However, this would mean I would have to hide a month column everytime that a month has ended. This is not practical and I would like it to be automatic.

 

Can anybody help me?

 

Thank you in advance!

Gabriela

 

1 ACCEPTED SOLUTION
v-kkf-msft
Community Support
Community Support

Hi @GM_AUS ,

 

You need to add a complete Calendar table. 

 

Calendar =
ADDCOLUMNS (
    CALENDAR ( DATE ( 2022, 1, 1 ), DATE ( 2023, 12, 31 ) ),
    "Year", YEAR ( [Date] ),
    "Month", FORMAT ( [Date], "mmmm" ),
    "MonthNum", MONTH ( [Date] ),
    "Is futuremonth", IF ( [Date] > EOMONTH ( TODAY (), -1 ), "Yes", "No" )
)

vkkfmsft_0-1652081359658.png

 

Then use the Calendar[Month] column in the matrix and filter it using the Calendar[Year] and Calendar[Is futuremonth] fields.

 

vkkfmsft_1-1652081375350.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
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

6 REPLIES 6
v-kkf-msft
Community Support
Community Support

Hi @GM_AUS ,

 

You need to add a complete Calendar table. 

 

Calendar =
ADDCOLUMNS (
    CALENDAR ( DATE ( 2022, 1, 1 ), DATE ( 2023, 12, 31 ) ),
    "Year", YEAR ( [Date] ),
    "Month", FORMAT ( [Date], "mmmm" ),
    "MonthNum", MONTH ( [Date] ),
    "Is futuremonth", IF ( [Date] > EOMONTH ( TODAY (), -1 ), "Yes", "No" )
)

vkkfmsft_0-1652081359658.png

 

Then use the Calendar[Month] column in the matrix and filter it using the Calendar[Year] and Calendar[Is futuremonth] fields.

 

vkkfmsft_1-1652081375350.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanx a lot! That worked! Now I can see all columns that are empty and the values of year 2022 and 2023 are not grouped. 🙂

GM_AUS_0-1652141237962.png

 

ddpl
Solution Sage
Solution Sage

Please try this:

 

Step 1 : You should create new table with filtering column "isfuture month" =yes as per below snap

 

"

New Table for where 'Is futuremonth is "Yes" = CALCULATETABLE(SUMMARIZE('Projects by Domain','Projects by Domain'[Date],'Projects by Domain'[Month],'Projects by Domain'[Perc Allocation],'Projects by Domain'[Project],'Projects by Domain'[Role],'Projects by Domain'[Staff],'Projects by Domain'[Year],'Projects by Domain'[isFutureMonth]),FILTER('Projects by Domain','Projects by Domain'[isFutureMonth] = "Yes"))"
 
 
VipulGadhiya_0-1651644207575.png

 

Step2 : now create matrix as per below using new table.

 

VipulGadhiya_2-1651644425937.png

 


If its worked plz mark as accepted as solution.

GM_AUS
Regular Visitor

Hi VipulGahiya! Thank you for your reply! It is actually not necessary to create another table for that. You can use the Filters' pane to set up a filter based on the column isFutureMonth = "yes". We get the same result.

 

However, from your solution it is still not possible to see the columns with no values. Notice that on your screenshot,  from August 2022 to January 2023, nothing is shown. But I need to be able to see when a column is empty as well 😞

 

To solve this, I tried Visualisations pane >> Columns >> clicked on the down arrow >> "Show items with no data". See below:

 

GM_AUS_1-1651714701964.png

 

 

But then, another problem:  it shows everything, starting from January 2022. See screenshot below:

 

GM_AUS_3-1651715074495.png

 

 

So, I am not sure how to fix that 😞 

 

Thank you for your help.

Gabriela

 

 

 

danextian
Super User
Super User

Hi @GM_AUS ,

There are multiple approaches to your use case.
One: Create a calculated column that will check whether the month in [Date] is greater than the today's month and use that as a visual filter or as a filter condition in a measure.

Is a Future Month? =
VAR __CURRENT =
    VALUE ( FORMAT ( TODAY (), "YYYYMM" ) )
RETURN
    VALUE ( FORMAT ( 'Projects by Domain'[Date], "YYYYMM" ) ) > __CURRENT

And then a measure to show future months even those that don't have a value:

Sum of Per Alloc - Future Months =
CALCULATE (
    SUM ( 'Projects by Domain'[Perc Allocation] ) + 0,
    //+0 to show blanks as zeroes
    FILTER (
        'Projects by Domain',
        'Projects by Domain'[Is a Future Month?] = TRUE ()
    )
)

 Two: Use just a measure

Sum of Per Alloc as a measure - Future Months = 
VAR Day1NextMonth =
    EOMONTH ( TODAY (), 0 ) + 1
RETURN
    CALCULATE (
        SUM ( 'Projects by Domain'[Perc Allocation] ) + 0,
        FILTER ( 'Projects by Domain', 'Projects by Domain'[Date] >= Day1NextMonth )
    )

 

I have tested both approaches in a matrix. Although they calculate the value for future months, they will still show past months but as zero.  So as a workaround, you may use the calculated column in the first approach to filter the visual or the page and, instead of using the month from date hierarchy, use a calculated column that will show both month and year.

Here's the pbix -  https://drive.google.com/file/d/1cig610F1dVHHj5Av_86c3Sk56Ak7yqY2/view?usp=sharing 










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


Proud to be a Super User!









"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.

Hi danextian!

 

Thank you for your reply. I have checked your file and followed your instruction: "as a workaround, you may use the calculated column in the first approach to filter the visual or the page and, instead of using the month from date hierarchy, use a calculated column that will show both month and year."

 

However, it seems that I can't see the columns refering to september, october, november and december 2022 because they are empty. But it is important for me to be able to see when a column is empty. This is what I can see:

GM_AUS_0-1651723234641.png

Note that "show items with no data" is selected for Columns >> YYYYMM.

 

If you have any idea, let me know. I would really appreaciate your help.

 

Thank you!

Gabriela.

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.