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

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.

Reply
kkalyanrr
Helper V
Helper V

No. of Jobs between Price changes between two dates

Hello ,

I'm trying to achieve the result shown in the below pic, I've 2 tables one with price change information and one with regular orders.
So trying to identify the jobs between the price changes.
Please help out.Excel.PNG

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

Hi @kkalyanrr 

If you build a calculated column it won't be dynamic by selectvalue.

I build a sample with Table1 and Table2 same like yours to have a test.

Please try my measure to achieve your goal.

 

Measure = 
VAR _MaxDate = MAXX(FILTER(ALL(Table1),Table1[Deposit Price Changed ON]< MAX(Table1[Deposit Price Changed ON])),Table1[Deposit Price Changed ON])
VAR _SelectValue = SELECTEDVALUE(Table2[Deposit])
VAR _SelectMin = MAXX(FILTER(ALL(Table1),Table1[Deposit Price Changed ON]< _SelectValue),Table1[Deposit Price Changed ON])
VAR _SelectMAX = MINX(FILTER(ALL(Table1),Table1[Deposit Price Changed ON]> _SelectValue),Table1[Deposit Price Changed ON])
VAR _SelectCount = CALCULATE(COUNT(Table2[Deposit]),FILTER(ALL(Table2),Table2[Deposit]>=_SelectMin&&Table2[Deposit]<=_SelectMAX))
VAR _Count = CALCULATE(COUNT(Table2[Deposit]),FILTER(ALL(Table2),Table2[Deposit]<=MAX(Table1[Deposit Price Changed ON])&&Table2[Deposit]>=_MaxDate))+0
RETURN
IF(ISFILTERED(Table2[Deposit]),IF(MAX(Table1[Deposit Price Changed ON]) = _SelectMAX,_SelectCount,0),_Count)
No. of Jobs before changed date = SUMX(Table1,[Measure])

 

Result is as below.

By default:

1.png

Select Deposit in Table2. For Example when I select 2020/11/15 it will show values in range(2020/08/06 <2020/11/15<2021/02/01).

2.png

If this reply couldn't solve your problem, please show more details about the result you want.

 

Best Regards,

Rico Zhou

 

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

3 REPLIES 3
v-rzhou-msft
Community Support
Community Support

Hi @kkalyanrr 

If you build a calculated column it won't be dynamic by selectvalue.

I build a sample with Table1 and Table2 same like yours to have a test.

Please try my measure to achieve your goal.

 

Measure = 
VAR _MaxDate = MAXX(FILTER(ALL(Table1),Table1[Deposit Price Changed ON]< MAX(Table1[Deposit Price Changed ON])),Table1[Deposit Price Changed ON])
VAR _SelectValue = SELECTEDVALUE(Table2[Deposit])
VAR _SelectMin = MAXX(FILTER(ALL(Table1),Table1[Deposit Price Changed ON]< _SelectValue),Table1[Deposit Price Changed ON])
VAR _SelectMAX = MINX(FILTER(ALL(Table1),Table1[Deposit Price Changed ON]> _SelectValue),Table1[Deposit Price Changed ON])
VAR _SelectCount = CALCULATE(COUNT(Table2[Deposit]),FILTER(ALL(Table2),Table2[Deposit]>=_SelectMin&&Table2[Deposit]<=_SelectMAX))
VAR _Count = CALCULATE(COUNT(Table2[Deposit]),FILTER(ALL(Table2),Table2[Deposit]<=MAX(Table1[Deposit Price Changed ON])&&Table2[Deposit]>=_MaxDate))+0
RETURN
IF(ISFILTERED(Table2[Deposit]),IF(MAX(Table1[Deposit Price Changed ON]) = _SelectMAX,_SelectCount,0),_Count)
No. of Jobs before changed date = SUMX(Table1,[Measure])

 

Result is as below.

By default:

1.png

Select Deposit in Table2. For Example when I select 2020/11/15 it will show values in range(2020/08/06 <2020/11/15<2021/02/01).

2.png

If this reply couldn't solve your problem, please show more details about the result you want.

 

Best Regards,

Rico Zhou

 

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

@kkalyanrr , A new column in table 1 can give you count

 

new column =
var _max = maxx(filter(Table1, [UKC] =earlier([UKC]) && [Deposit chnage price on] <earlier([Deposit chnage price on])),[Deposit chnage price on])
return
countx(filter(Table2 , Table1[UKC] =Table2[UKC] && Table2[Deposit] <= Table1[Deposit chnage price on] && (isblank(_max) || Table2[Deposit] >=_max)),Table2[UKC] )

@amitchandak 
Thank you it worked, how ever when I try to interact with chart from Table 2 , the other chart which is from Table1 is not responsive..
Please help on fixing it.Excel.PNG

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.