The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
This is my main table that has Names associated with each month.
I need to find the individual monthly counts of names and the intersection of names between any 2 months chosen on the slicer. I have duplicated the "month" column and have 2 slicers for month 1 and month 2. Month 1 filters only KPI card 1 and Month 2 filters only KPI card 2.
There is a 3rd KPI card that should show how many names overlap between Jan and Feb. This KPI card is affected by the values chosen in both slicers (month 1 and month 2). Here is my overlap measure.
TEST Overlap =
VAR SelectedMonth1 = SELECTEDVALUE('NI Table'[Month], BLANK())
VAR SelectedMonth2 = SELECTEDVALUE('NI Table'[Month-2], BLANK())
// Ensure that both selected months are valid
RETURN
IF(
ISBLANK(SelectedMonth1) || ISBLANK(SelectedMonth2),
BLANK(),
// Calculate names specific to each month contextually
VAR NamesInMonth1 =
CALCULATETABLE(
VALUES('NI Table'[Name]),
'NI Table'[Month] = SelectedMonth1
)
VAR NamesInMonth2 =
CALCULATETABLE(
VALUES('NI Table'[Name]),
'NI Table'[Month] = SelectedMonth2
)
// Count overlapping names
VAR OverlapCount =
COUNTROWS(
INTERSECT(NamesInMonth1, NamesInMonth2)
)
// Return the overlap count
RETURN
OverlapCount
)
The problem is "overlap measure" returns blank. The VAR selectedmonth1 and selectedmonth2 (defined inside the measure) both return blank in this measure. If I choose the same month (say, Jan) in both slicers then the KPI card shows the count for that month (Jan, in our example), else it shows blank when 2 different months are chosen on the slicers. Could someone please help me where I could be making a mistake or what I could do different?
Thank you so much!
Solved! Go to Solution.
Name | Month | MonthNum | Month-2 |
Joy | Jan | 1 | Jan |
Nita | Jan | 1 | Jan |
Goks | Jan | 1 | Jan |
Joy | Feb | 2 | Feb |
Sophie | Feb | 2 | Feb |
Sage | Feb | 2 | Feb |
Serena | Mar | 3 | Mar |
Sophie | Mar | 3 | Mar |
Sage | Mar | 3 | Mar |
Nita | Apr | 4 | Apr |
Joy | Apr | 4 | Apr |
Pappu | Apr | 4 | Apr |
Goks | May | 5 | May |
Pappu | May | 5 | May |
Joy | May | 5 | May |
Jade | Feb | 2 | Feb |
Paddy | Mar | 3 | Mar |
Jamin | Feb | 2 | Feb |
Thank you so much @Ashish_Mathur and @lbendlin. I have uploaded the sample data as a table here. So, I am trying to recreate what a Venn diagram would do. Below I show the result I expect as a screenshot. By choosing 2 different months in the slicers, the red box should display the number of names that appear in both months as selected in the slicers. I am able to get the green boxes right. It's the red one that is an issue. So far I have found that if I duplicate the 'Names' table and use the 'month' fields from 2 different tables for the month-slicers then the red box gives me the correct output. I'd like to know if I can acheive the same result without duplicating the table. Thank you. FYI - I have pasted the DAX code for the 'overlap measure' in my earlier post.
You are welcome.
Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Please show the expected outcome based on the sample data you provided.
Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...
Hi,
I'd like to try. Share the download link of the PBI file.
User | Count |
---|---|
78 | |
73 | |
38 | |
30 | |
28 |
User | Count |
---|---|
107 | |
100 | |
55 | |
49 | |
45 |