Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi everyone!
I have 2 tables: one table is a fact table containing dates field and the number of events, another table is a dimension table containing names and dates of creating these names. These tables are related by the field id_n, but I need calculate measure that will calculate the number of names (from table 2) per each date (from table 1) where created_date (from table 2) is greater than or equal to date (from table 1).
The formula should looks like measure_table_1 = COUNT( IF(table_2[created_date] > = table_1[date], table_2[id_n]) )
Thanks!
Solved! Go to Solution.
Hi @Anonymous ,
You can create a measure as below, please find the details in the attachment.
Count of names =
CALCULATE (
DISTINCTCOUNT ( 'Table 2'[name_id] ),
FILTER (
ALL('Table 2'),
'Table 2'[create_date] >= SELECTEDVALUE ( 'Table 1'[date] )
)
)
Best Regards
@Anonymous , Try like
measure_table_1 = calculate(COUNTX(table_2, IF(table_2[created_date] > = max(table_1[date]), table_2[id_n],blank()) ),values(table_2[id_n]), crossfilter(table_2[id_n],table_1[id_n], none))
Hi. Thanks for the answer. But is it possible to do calculation without creating a new table?
Hi @Anonymous ,
You can create a measure as below, please find the details in the attachment.
Count of names =
CALCULATE (
DISTINCTCOUNT ( 'Table 2'[name_id] ),
FILTER (
ALL('Table 2'),
'Table 2'[create_date] >= SELECTEDVALUE ( 'Table 1'[date] )
)
)
Best Regards
Thank you very much!
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 38 | |
| 38 | |
| 37 | |
| 28 | |
| 28 |
| User | Count |
|---|---|
| 124 | |
| 89 | |
| 73 | |
| 66 | |
| 65 |