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
stella1215
Frequent Visitor

Link Productx function with time slicer and calculate start from 1

Hello everyone, I have a question about Productx. I have a time period selected, and within the time period, I want to calculate the product of the "ReturnRate" column if there's a 1 in the "Action" column on the same row, ignoring the rows with 0 in "Action" column.
Especially, when I change my time slicer, the calculation should always start from 1 like it is showing as the "ExpectedResult" column.

 

My dax is showing like this:

 

 

 

MyResult = 
CALCULATE (
    PRODUCTX ( test, test[ReturnRate] * test[Action] + ( 1 - test[Action] ) ),
    FILTER ( ALL ( test ), test[Date] <= MAX ( test[Date] ) )
)

 

 

 

 

 

 

But I want the result to look like the ExpectedResult. 

 

DateActionReturnRateMyResultExpectedResult
1/1/202111.0101781.0101781.000000
1/2/202111.0025511.0127551.010178
1/3/202100.9800251.0127551.012755
1/4/202100.9576691.0127551.012755
1/5/202100.9472391.0127551.012755
1/6/202110.9796170.9921121.012755
1/7/202100.9708800.9921120.992112
1/8/202110.9861110.9783330.992112
1/9/202110.9663610.9454230.978333
1/10/202100.9250300.9454230.945423

 

Is there any way to fix my dax and let it also work with my time slicer for different period? Thank you! Any help will be much appreciated!! 

1 ACCEPTED SOLUTION
wdx223_Daniel
Super User
Super User

3 REPLIES 3
wdx223_Daniel
Super User
Super User

wdx223_Daniel_0-1612487425462.png

 

rfigtree
Resolver III
Resolver III

Havent looked closely, wife wants to watch a tv show with me.

But this is possibly part of your problem.

 

MyResult = 
CALCULATE (
    PRODUCTX ( test, test[ReturnRate] * test[Action] + ( 1 - test[Action] ) ),
    FILTER ( ALL ( test ), test[Date] <= MAX ( test[Date] ) )
)

try

MyResult = 
var MaxDate = max(test[Date])
return
CALCULATE (
    PRODUCTX ( test, test[ReturnRate] * test[Action] + ( 1 - test[Action] ) ),
    FILTER ( ALL ( test ), test[Date] <= MaxDate ) )
)

 

Haha you are definitely a great husband! But I don't think adding a variable fixed my problem tho ;-;

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.