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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Anonymous
Not applicable

Create measure which excludes the relationship or slicer

Below is the screenshot of my report. I have a date hierarchy filter which comes from DimDate table and filters all the other visuals. However I need the below two pie charts to be constant. It should not accept the value from Slicer not only by means of edit interactions, but also it should avoid the relationship between the source table and DimDate table.

 

1st Pie Chart - Number of employees joined on current month Apr 2021

2nd Pie Chart - Number of employees joined on current month but  previous year Apr 2020

 

How to do this. Please help.

 

Screenshot 2021-04-25 144504.jpg

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

Hi @Anonymous ,

Please correct me if I wrongly understood your question.

You said that you need your calculation like the count of employees who were active in the company for current month and last year same month. So we only need to count the end date in the current month . If the current month of last year, the end date is between the first and last day of the current month.

I create two measures to count the number of employees whose end date in current month and current month in previous year .

 

last year current month = CALCULATE(COUNTA('Table'[Employee Name]),FILTER('Table','Table'[End Date]>=DATE(YEAR(TODAY())-1,MONTH(TODAY()),1) && 'Table'[End Date]<=EOMONTH(DATE(YEAR(TODAY())-1,MONTH(TODAY()),1),0)))

current year current month = CALCULATE(COUNTA('Table'[Employee Name]),FILTER('Table','Table'[End Date]>=DATE(YEAR(TODAY()),MONTH(TODAY()),1)))

 

The effect is as shown :

Ailsa-msft_0-1619487078945.png

If your data does not want to be affected by the slicer and relationship , you can edit interactions in Pie Charts , set None . And then make the relationship between the source table and DimDate table interactive .

 

Best Regards

Community Support Team _ Ailsa Tao

 

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

4 REPLIES 4
v-yetao1-msft
Community Support
Community Support

Hi @Anonymous ,

Please correct me if I wrongly understood your question.

You said that you need your calculation like the count of employees who were active in the company for current month and last year same month. So we only need to count the end date in the current month . If the current month of last year, the end date is between the first and last day of the current month.

I create two measures to count the number of employees whose end date in current month and current month in previous year .

 

last year current month = CALCULATE(COUNTA('Table'[Employee Name]),FILTER('Table','Table'[End Date]>=DATE(YEAR(TODAY())-1,MONTH(TODAY()),1) && 'Table'[End Date]<=EOMONTH(DATE(YEAR(TODAY())-1,MONTH(TODAY()),1),0)))

current year current month = CALCULATE(COUNTA('Table'[Employee Name]),FILTER('Table','Table'[End Date]>=DATE(YEAR(TODAY()),MONTH(TODAY()),1)))

 

The effect is as shown :

Ailsa-msft_0-1619487078945.png

If your data does not want to be affected by the slicer and relationship , you can edit interactions in Pie Charts , set None . And then make the relationship between the source table and DimDate table interactive .

 

Best Regards

Community Support Team _ Ailsa Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Fowmy
Super User
Super User

@Anonymous 

You can create two measures as follows, changing the date slicer will not affect the measures.

Apr 2020 Count = 
CALCULATE(
    COUNTROWS(Employees),
    DimDate[Year] = 2020,
    DimDate[Month] = 4
)

 

Apr 2021 Count = 
CALCULATE(
    COUNTROWS(Employees),
    DimDate[Year] = 2021,
    DimDate[Month] = 4
)

 

 



Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

@Fowmy 

 

I don't need to hard code values. I need for current month and last year same month.

 

Also I have start date and end date of employee. I need my calculation like the count of employees who were active in the company for current month and last year same month.

 

DimDate should be no where involved in my calculations.

@Anonymous 

In this case, please share a sample dataset that represents your actual data to understand the format.

 

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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