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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch 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
Anonymous
Not applicable

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

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
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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.