Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare 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.
Check out the October 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
110 | |
99 | |
95 | |
88 | |
70 |
User | Count |
---|---|
165 | |
131 | |
129 | |
102 | |
98 |