Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I am really struggling with this one - hoping some one can help me.
I want to count for each customer the number of months. I have two key tables:
Tabel_10 :
- Customer
- Customer_Group
- Date
- Date_L12
Tabel_9
- Customer
- Customer_Group
- Date
The two table are joined by the key "Customer".
So what I want, is that:
for each customer in table_10 I want to see how many times he appears in table_9 between the data range tabel_10[Date] & Table_10[Date_L12]
So what I want is a new column "Frequency" in Tabel_10.
Solved! Go to Solution.
Hi @Joana_ ,
I created some data:
Table_9:
Table_10:
Here are the steps you can follow:
1. Create calculated column.
Flag =
var _table10=
SELECTCOLUMNS('Table_10',"1",[Customer])
var _if=
IF(
'Table_9'[Customer] in _table10
&&
'Table_9'[Date]>=MAXX(FILTER(ALL(Table_10),'Table_10'[Customer]=EARLIER('Table_9'[Customer])),[Date])
&&
'Table_9'[Date]<=MAXX(FILTER(ALL(Table_10),'Table_10'[Customer]=EARLIER('Table_9'[Customer])),[Date_L12])
,1,0)
return
_if
Column =
COUNTX(
FILTER(ALL(Table_9),
'Table_9'[Flag]=1),[Customer])
2. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi @Joana_ ,
I created some data:
Table_9:
Table_10:
Here are the steps you can follow:
1. Create calculated column.
Flag =
var _table10=
SELECTCOLUMNS('Table_10',"1",[Customer])
var _if=
IF(
'Table_9'[Customer] in _table10
&&
'Table_9'[Date]>=MAXX(FILTER(ALL(Table_10),'Table_10'[Customer]=EARLIER('Table_9'[Customer])),[Date])
&&
'Table_9'[Date]<=MAXX(FILTER(ALL(Table_10),'Table_10'[Customer]=EARLIER('Table_9'[Customer])),[Date_L12])
,1,0)
return
_if
Column =
COUNTX(
FILTER(ALL(Table_9),
'Table_9'[Flag]=1),[Customer])
2. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
P.S. the column about the "Date" are based on months.
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
71 | |
70 | |
43 | |
31 | |
26 |
User | Count |
---|---|
89 | |
49 | |
44 | |
38 | |
37 |