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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
klehar
Helper V
Helper V

Selectively show and hide months for measures

So this might be a wierd requirement but let me explain in the easiest way possible

 

I have 5 measures. I will call then 

a,b,c,d,e
Im visualising these 5 measures on 5 different line charts against common date dimension (month)

Now for measures : a,b,c - I dont want to show latest month which is feb 2025 currently because there is no data yet. I will show this next week.

For d,e I want to show current month feb, becuase i have the data already

 

I want to create a measure or a column such that

In that single measure I can write in all the measures that i want to hide the current month for

Next week when I have the data for the current month, then ill remove those measures from a single measure

 

I already have the logic for finding current month. its in my date dimension called current month pbi

 

Current Month PBI =
VAR CurrentDate = TODAY() //6 Feb 2025
VAR CurrentYear = YEAR(CurrentDate) //2025
VAR CurrentMonth = MONTH(CurrentDate) //02
VAR currentyearmonth = CurrentYear*100+CurrentMonth
RETURN
IF(
FORMAT('DIM Date'[FISCAL_MONTH_NUMBER_YYYYMM], "000000") = FORMAT(currentyearmonth, "000000"),"Yes","No")


For additional context this is one measure where feb data will be available next week so i will hide feb month now


klehar_0-1738853307806.png

 

 

This is another measure where feb data is availble so i dont want to hide feb data here

klehar_1-1738853337591.png

 

3 REPLIES 3
bhanu_gautam
Super User
Super User

@klehar Create a calculated column to identify the current month:

DAX
Current Month PBI =
VAR CurrentDate = TODAY() //6 Feb 2025
VAR CurrentYear = YEAR(CurrentDate) //2025
VAR CurrentMonth = MONTH(CurrentDate) //02
VAR currentyearmonth = CurrentYear * 100 + CurrentMonth
RETURN
IF(
FORMAT('DIM Date'[FISCAL_MONTH_NUMBER_YYYYMM], "000000") = FORMAT(currentyearmonth, "000000"),
"Yes",
"No"
)

 

Create a measure to conditionally hide the current month for specific measures:

DAX
Measure A Filtered =
IF(
[Current Month PBI] = "Yes" && [Measure Name] IN {"a", "b", "c"},
BLANK(),
[Measure A]
)

Measure B Filtered =
IF(
[Current Month PBI] = "Yes" && [Measure Name] IN {"a", "b", "c"},
BLANK(),
[Measure B]
)

Measure C Filtered =
IF(
[Current Month PBI] = "Yes" && [Measure Name] IN {"a", "b", "c"},
BLANK(),
[Measure C]
)

Measure D Filtered =
[Measure D]

Measure E Filtered =
[Measure E]

 

Replace the original measures a, b, c, d, and e in your line charts with the new filtered measures Measure A Filtered, Measure B Filtered, Measure C Filtered, Measure D Filtered, and Measure E Filtered.




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






so what im looking out for is a single column where i can use selectedmeasure dax and edit all measures in a single measure

then put that on the filter shelf to show yes or no

Hi @klehar,

Thanks for the reply from bhanu_gautam.

 

If you want to create a single column where you could edit all measures, please try to use SELECTEDMEASURE() in a single measure that checks whether the measure you’re visualizing needs to be filtered out for the current month (February) or not.

 

Create a mesure by the following DAX:

Measure_Visibility = 
VAR CurrentMonthStatus = [Current Month PBI]  // Your existing logic
VAR IsFebruary = CurrentMonthStatus = "Yes"  // Check if the current month is February

// Logic to return "Yes" or "No" for selected measures
RETURN
    SWITCH(
        TRUE(),
        SELECTEDMEASURE() IN { [a], [b], [c] } && IsFebruary, "No",  // Hide a, b, c in February
        SELECTEDMEASURE() IN { [d], [e] }, "Yes",  // Always show d and e
        "Yes"  // Default for other cases
    )

 

Now, you can add the Measure_Visibility measure to the filters pane of your visual and set the filter to only show values where it equals "Yes". This will dynamically control which measures are shown based on the logic you defined.

 

Best Regards,
Qi
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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