Forum Discussion
Conditional Calculation
- 6 years ago
Hi mtb1973 ,
Assuming the Date range is changed according the date slicer, you can create measure like DAX below.
Measure1 = VAR FromDate = CALCULATE ( MIN ( Slicer[Date] ), ALLSELECTED ( Slicer[Date] ) ) VAR ToDate = CALCULATE ( MAX ( Slicer[Date] ), ALLSELECTED ( Slicer[Date] ) ) RETURN SWITCH ( TRUE (), ToDate <= DATE ( 2019, 8, 1 ), [MeasureA], FromDate > DATE ( 2019, 8, 1 ), [MeasureB], FromDate < DATE ( 2019, 8, 1 ) && ToDate > DATE ( 2019, 8, 1 ), [MeasureA] & " " & [MeasureB] )If I misunderstood it, could you please share your sample data and desired output screenshots for further analysis? You can also upload sample pbix to OneDrive and post the link here. Do mask sensitive data before uploading.
Best Regards,
Amy
Community Support Team _ Amy
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi mtb1973 ,
Assuming the Date range is changed according the date slicer, you can create measure like DAX below.
Measure1 =
VAR FromDate =
CALCULATE ( MIN ( Slicer[Date] ), ALLSELECTED ( Slicer[Date] ) )
VAR ToDate =
CALCULATE ( MAX ( Slicer[Date] ), ALLSELECTED ( Slicer[Date] ) )
RETURN
SWITCH (
TRUE (),
ToDate <= DATE ( 2019, 8, 1 ), [MeasureA],
FromDate > DATE ( 2019, 8, 1 ), [MeasureB],
FromDate < DATE ( 2019, 8, 1 )
&& ToDate > DATE ( 2019, 8, 1 ), [MeasureA] & " " & [MeasureB]
)
If I misunderstood it, could you please share your sample data and desired output screenshots for further analysis? You can also upload sample pbix to OneDrive and post the link here. Do mask sensitive data before uploading.
Best Regards,
Amy
Community Support Team _ Amy
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.