Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Create new column from filtered data of another table

Hello all,


I tryed to find any similar topics but without success 😞

I want table with values from metrics table filtered only for live customers – customers with least one valid validity in that date.

 

Metrics table

Stores measured metrics from customers in monthly period (last day of month)

Sample dateCustomerIdMetric1Metric2
2020-12-311100200
2020-12-3125050
2020-12-3132010
2020-12-31411
2021-01-311110210
2021-01-3125560
2021-01-3132515
2021-01-31455
2021-02-281115230
2021-02-2825560
2021-02-2833025
2021-02-284105

 

Customer licence validity table

CustomerIdValidFromValidTo
12015-11-132017-02-10
12016-11-042018-02-10
12017-11-022019-02-10
12018-11-082020-02-10
12019-11-122021-02-10
12020-10-252022-02-10
22015-11-132017-02-10
22016-11-042018-02-10
22017-11-072019-02-10
22018-11-082020-02-10
22019-11-122021-02-10
22020-10-252022-02-10
32015-11-132017-02-10
42015-11-132021-01-01

 

What I need is table

YearMonthMetrics1 sumMetrics2 sum
2020December100 (customer1 license is valid in december – two valid licences in that date) + 50 (cust2 valid) + 1 (cust 4 valid)same principle…
2021January110 + 55 (only customer 1 and 2 have valid license)same principle…
2021February115 + 55 (only customer 1 and 2 have valid license)same principle…


I think best result would be add new colum to metrics table with bool „validLicense“  and then use this bool in measure on sum function. But I tryed that without success…


Can you help me please?

Link to XLS file with sample data

1 ACCEPTED SOLUTION
v-easonf-msft
Community Support
Community Support

Hi, @Anonymous 

Try calculated column as below:

validLicensecount = 
VAR date1 = 'Metrics Table'[Sample date]
VAR Customer = 'Metrics Table'[CustomerId]
VAR tab1 =
    FILTER (
        'Customer licence validity Table',
        'Customer licence validity Table'[CustomerId] = Customer
    )
VAR count1 =
    COUNTAX (
        FILTER (
            tab1,
            date1 > 'Customer licence validity Table'[ValidFrom]
                && date1 < 'Customer licence validity Table'[ValidTo]
        ),
        'Customer licence validity Table'[CustomerId]
    ) + 0
RETURN
    count1
validLicense = 
IF ( 'Metrics Table'[validLicensecount] > 0, "Valid license" )

31.png

Filter the table visual as below:

32.png

Please check my sample file for more details.
Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

2 REPLIES 2
v-easonf-msft
Community Support
Community Support

Hi, @Anonymous 

Try calculated column as below:

validLicensecount = 
VAR date1 = 'Metrics Table'[Sample date]
VAR Customer = 'Metrics Table'[CustomerId]
VAR tab1 =
    FILTER (
        'Customer licence validity Table',
        'Customer licence validity Table'[CustomerId] = Customer
    )
VAR count1 =
    COUNTAX (
        FILTER (
            tab1,
            date1 > 'Customer licence validity Table'[ValidFrom]
                && date1 < 'Customer licence validity Table'[ValidTo]
        ),
        'Customer licence validity Table'[CustomerId]
    ) + 0
RETURN
    count1
validLicense = 
IF ( 'Metrics Table'[validLicensecount] > 0, "Valid license" )

31.png

Filter the table visual as below:

32.png

Please check my sample file for more details.
Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

amitchandak
Super User
Super User

@Anonymous , not able to get you logic.

 

But you can try a new column in table two like

new column =

var _cnt = countx(filter(Table2, Table2[customer id] =  Table1[customer id] && Table1[sample date] >= Table2[valid from]  && Table1[sample date] <= Table2[valid to]), Table2[customer id]) 

 

return 

_cnt*50

 

refer 4 ways to copy data from one table to another
https://www.youtube.com/watch?v=Wu1mWxR23jU
https://www.youtube.com/watch?v=czNHt7UXIe8

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors