Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreThe FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now
Hi Expert,
I'm interested in comparing the resource count between any two given months say April and May for those departments that were existed in the previous month as well. For instance, in the given table, Department 2 did not exist in the previous month, so it should be excluded from the calculation of resource count.
I need assistance to dynamically remove/filter out those departments which were not exist in previous month from my table either by power query or via DAX.
Input Data
| Resource | Deaprtment | Assignment Date |
| Resource 1 | Deaprtment 1 | 4/1/2024 |
| Resource 2 | Deaprtment 1 | 4/1/2024 |
| Resource 3 | Deaprtment 1 | 5/1/2024 |
| Resource 4 | Deaprtment 2 | 5/1/2024 |
| Resource 5 | Deaprtment 2 | 5/1/2024 |
Required Table
| Resource | Deaprtment | Assignment Date |
| Resource 1 | Deaprtment 1 | 4/1/2024 |
| Resource 2 | Deaprtment 1 | 4/1/2024 |
| Resource 3 | Deaprtment 1 | 5/1/2024 |
Solved! Go to Solution.
@lbendlin @Ashish_Mathur Thanks for your contribution on this thread.
Hi @Sonu88 ,
You can follow the steps below to get it, please find the details in the attachment.
1. Create a measure as below
Flag =
VAR _department =
SELECTEDVALUE ( 'Table'[Deaprtment] )
VAR _departs =
CALCULATETABLE (
VALUES ( 'Table'[Deaprtment] ),
FILTER (
ALLSELECTED ( 'Table' ),
MONTH ( 'Table'[Assignment Date] )
= MONTH ( TODAY () ) - 1
)
)
RETURN
IF ( _department IN _departs, 1, 0 )
2. Create a table visual and apply a visual-level filter on it with the condition (Flag is 1)
Best Regards
Hi,
PBI file attached.
Hope this helps.
@lbendlin @Ashish_Mathur Thanks for your contribution on this thread.
Hi @Sonu88 ,
You can follow the steps below to get it, please find the details in the attachment.
1. Create a measure as below
Flag =
VAR _department =
SELECTEDVALUE ( 'Table'[Deaprtment] )
VAR _departs =
CALCULATETABLE (
VALUES ( 'Table'[Deaprtment] ),
FILTER (
ALLSELECTED ( 'Table' ),
MONTH ( 'Table'[Assignment Date] )
= MONTH ( TODAY () ) - 1
)
)
RETURN
IF ( _department IN _departs, 1, 0 )
2. Create a table visual and apply a visual-level filter on it with the condition (Flag is 1)
Best Regards
Hi,
Quite confused about what you want. In the text, you mention that you want a count but yo have shown the expected result as a Table. Show the expected result very clearly. Share data in a format that can be pasted in an Excel file.
Hello Ashish
Many apologizes, please consider the 'Required Table' table as a desired result. Once i am able to generate the final table which excludes those departments, then I can create required measures. I hope it clean now.
If you want to compare 2 months, then atleast share data for 2 months in the sample dataset. Your sample data has just 1 month.
Hi Ashish
The input table has already May month data under Assignment Date column.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 53 | |
| 40 | |
| 38 | |
| 19 | |
| 18 |
| User | Count |
|---|---|
| 70 | |
| 69 | |
| 34 | |
| 33 | |
| 30 |