Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Take the example below,
Please assist to come up with a formula that identifies the common items appearing in all the months.
Date (DD/MM/YYYY) | Item |
01/08/2022 | X |
03/08/2022 | Y |
01/09/2022 | Z |
02/09/2022 | X |
03/09/2022 | Y |
01/09/2022 | W |
01/10/2022 | X |
22/10/2022 | Y |
01/11/2022 | X |
11/11/2022 | R |
23/11/2022 | Y |
01/12/2022 | X |
12/12/2022 | Y |
Hi @hosea_chumba
Apologies for the late reply.
Please refer to attached sample file and below description. Hopping this is what you're looking for.
Place the following filter measure in the filter pane of the table or chart visual and select "is" 1 or "is not blank"
Filter Measure =
VAR T1 = CALCULATETABLE ( 'Table', ALLEXCEPT ( 'Table', 'Table'[Item] ) )
VAR T2 = SELECTCOLUMNS ( T1, "@YearMonth", FORMAT ( [Date], "YYYYMM" ) )
VAR T3 = SELECTCOLUMNS ( ALLSELECTED ('Table'[Date] ), "@YearMonth", FORMAT ( [Date], "YYYYMM" ) )
VAR REsult =
IF (
ISEMPTY ( EXCEPT ( T3, T2 ) ),
1
)
RETURN
Result
I can only sovle this with a helper column.
1) add a calculated column like:
Month = FORMAT([Date], "YYYYMM")
2) create a calculated table like this:
List =
VAR _monthcount = DISTINCTCOUNT(TableName[Month])
RETURN
FILTER(
VALUES(TableName[Item]),
CALCULATE(DISTINCTCOUNT(TableName[Date])=_monthcount)
)
it worked like this:
just realized you have in maximum one row per item every month.
So the list - calculated table could be achieved without the helper column, like this:
List2 =
VAR _table =
ADDCOLUMNS(
TableName,
"YYYYMM",
FORMAT(TableName[Date], "YYYYMM")
)
VAR _monthcount = COUNTROWS(SUMMARIZE(_table, [YYYYMM]))
RETURN
FILTER(
VALUES(TableName[Item]),
CALCULATE(DISTINCTCOUNT(TableName[Date])=_monthcount)
)
do you want to count them or display them in a crad visual or just filter a table visual or something else?
NewMeasure =
CALCULATE (
COUNTROWS (
SUMMARIZE (
ADDCOLUMNS (
VALUES ( 'Sample'[Date] ),
"YYMM", FORMAT ( 'Sample'[Date], "YYMM" )
),
[YYMM]
)
),
ALL ( 'Sample'[Date] )
)
= CALCULATE (
COUNTROWS (
SUMMARIZE (
ADDCOLUMNS (
VALUES ( 'Sample'[Date] ),
"YYMM", FORMAT ( 'Sample'[Date], "YYMM" )
),
[YYMM]
)
),
ALL ( 'Sample' )
)
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
39 | |
21 | |
21 | |
14 | |
13 |
User | Count |
---|---|
44 | |
32 | |
30 | |
18 | |
17 |