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
Anonymous
Not applicable

How do I filter out data that shows in one chart that I want to ignore in another?

Hello all!

 

I am knew to power bi and even newer to the community, really hoping I can explain this well enough and hoping you all can help me. 

 

So in my dashboard I have a slicer and 2 charts. 

1. In my first chart I have Revenue - Labour - Profit <---- these are for each branch 

2. In the other I have budget Variance by branch 

* For simplicity I will refer to them as 1 or 2 

 

In my slicer I have it set as dates and when I've selected between the month ie July 1 - July 31 I should see the data in 2 

I want to "grey out" or "filter" the data in 2 when there's nothing to show if I were in between two months i.e July 15 - Aug 15 

The slicer for 2 should only work when I'm inside one month at a time. 

 

Any thoughts? 

 

 

5 REPLIES 5
Anonymous
Not applicable

Hi,

If i understand this correctly, you want to show the chart 2 only when then selected dates are in the same month.

If that is the scenario, try to follow below steps:

MinDate = CALCULATE( MIN( 'Calendar'[date] ), ALLSELECTED( 'Calendar'[date] ) )

MaxDate = CALCULATE( MAX( 'Calendar'[date] ), ALLSELECTED( 'Calendar'[date] ) )

Show Flag = 
VAR v_MinMonthYear = FORMAT( [MinDate], "MM-YYYY" )
VAR v_MaxMonthYear = FORMAT( [MaxDate], "MM-YYYY" )
RETURN
IF( v_MinMonthYear = v_MaxMonthYear, "1", "0" )

Here, the show flag return "1" only when the selected dates are in the same month of the same year.

Then, you can add a visual level filter on the second chart as:

result.PNG

Thanks.

Anonymous
Not applicable

Hi Vaibhavdesai, 

 

I'm having issues with that expression/logic. 

 

I appreciate your help! 

 

Please see the changes I have made 

 

Thank you, 

MinDate = CALCULATE( MIN( 'budgetrevenue' [paydate] ), ALLSELECTED( 'budgetrevenue' [paydate] ) )

MinDate = CALCULATE( MIN( 'budgetrevenue' [paydate]), ALLSELECTED( 'budgetrevenue' [paydate] ) )

//show flag didn't work for me?
//Am I supposed to change MinDate and Maxdate?

show Flag = VAR v_MinMonthYear = FORMAT( [MinDate], "MM-YYYY" ) VAR v_MaxMonthYear = FORMAT( [MaxDate], "MM-YYYY" ) RETURN IF( v_MinMonthYear = v_MaxMonthYear, "1", "0" )

 

Anonymous
Not applicable

Hi,

It would help if you could share your pbix.

Do you have seperate calendar or date table in your model?

Thanks.

Anonymous
Not applicable

Hello, 

 

Unfortunately I won't be able to send the pbix, but I have attached an image, does this help? Capture.PNG

 

I do have a separate Calendar and Date table. 

 

 

 

Anonymous
Not applicable

Hi,

I think you are trying to write the code for all the measures in just one measure.

You need to create 3 different measures.

Also note I have used Calendar[Date] for MinDate and MaxDate.

MinDate = CALCULATE( MIN( 'Calendar'[date] ), ALLSELECTED( 'Calendar'[date] ) )
MaxDate = CALCULATE( MAX( 'Calendar'[date] ), ALLSELECTED( 'Calendar'[date] ) )
Show Flag = 
VAR v_MinMonthYear = FORMAT( [MinDate], "MM-YYYY" )
VAR v_MaxMonthYear = FORMAT( [MaxDate], "MM-YYYY" )
RETURN
IF( v_MinMonthYear = v_MaxMonthYear, "1", "0" )

Thanks.

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.