Forum Discussion
Eyal
Helper II
8 years agoMeasure to calculate based on previous data point.
Hello, I need to multiply to parameters. One of which is sampled every 3 days and I need to use the previse sampled point for today calculation until a new sample point arrive, (See screen clip). ...
- 8 years ago
Hi Eyal
Following DAX formula will do the job
Product Of Day Parameters= VAR PreviousSample = IF ( ISBLANK ( Table1[Sample] ), CALCULATE ( LASTNONBLANK ( Table1[Sample], Table1[Sample] ), FILTER ( Table1, Table1[Day] < EARLIER ( Table1[Day] ) ) ), Table1[Sample] ) RETURN Table1[PARA2] * PreviousSample
Ashish_Mathur
Super User
8 years agoHi,
Try this
=calculate(PRODUCTX(Table2,Table2[PARA1]*IF(ISBLANK(Table2[Sample]),CALCULATE(SUM(Table2[Sample]),PREVIOUSDAY(Table2[Day])),Table2[Sample])),Table2[Day])
Hope this helps.
- Zubair_Muhammad8 years ago
Community Champion
Hi Eyal
Following DAX formula will do the job
Product Of Day Parameters= VAR PreviousSample = IF ( ISBLANK ( Table1[Sample] ), CALCULATE ( LASTNONBLANK ( Table1[Sample], Table1[Sample] ), FILTER ( Table1, Table1[Day] < EARLIER ( Table1[Day] ) ) ), Table1[Sample] ) RETURN Table1[PARA2] * PreviousSample- Eyal8 years ago
Helper II
Hi Zubair_Muhammad
thanks a lot work like a charm.
Eyal
- Eyal8 years ago
Helper II
HI Ashish_Mathur
tried your solution but did not get the correct result..
Thanks any way/
Eyal