Dear All, I´m new here and I´m new with Power BI.
I´m making my first dashboard and I have the following problem.
In my dashboard, I have a Slicer with date and that slicer control the Sales ammount (Sales[Ammount]).
I want to get the difference between these two dates selected in this slicer no matter if this are consecutive or not.
Is it possible ?
Thanks
Solved! Go to Solution.
Hi @gustavo468 ,
You can create a measure as below to get it, please find the details in the attachment.
Difference =
VAR _maxdate =
CALCULATE ( MAX ( 'Table'[Date] ), ALLSELECTED ( 'Table'[Date] ) )
VAR _secondmdate =
CALCULATE (
MAX ( 'Table'[Date] ),
FILTER ( ALLSELECTED ( 'Table'[Date] ), 'Table'[Date] < _maxdate )
)
VAR _mamount =
CALCULATE (
SUM ( 'Table'[Amount] ),
FILTER ( 'Table', 'Table'[Date] = _maxdate )
)
VAR _smamount =
CALCULATE (
SUM ( 'Table'[Amount] ),
FILTER ( 'Table', 'Table'[Date] = _secondmdate )
)
RETURN
_mamount - _smamount
If the above one is not working for you, please provide some sample data(exclude sensitive data) with Text format and your expected result with special examples and screenshots. It is better if you can provide me a simplified pbix file. Thank you.
Best Regards
Sorry, the difference between the ammount sales for those dates. Thanks
Hi @gustavo468 ,
You can create a measure as below to get it, please find the details in the attachment.
Difference =
VAR _maxdate =
CALCULATE ( MAX ( 'Table'[Date] ), ALLSELECTED ( 'Table'[Date] ) )
VAR _secondmdate =
CALCULATE (
MAX ( 'Table'[Date] ),
FILTER ( ALLSELECTED ( 'Table'[Date] ), 'Table'[Date] < _maxdate )
)
VAR _mamount =
CALCULATE (
SUM ( 'Table'[Amount] ),
FILTER ( 'Table', 'Table'[Date] = _maxdate )
)
VAR _smamount =
CALCULATE (
SUM ( 'Table'[Amount] ),
FILTER ( 'Table', 'Table'[Date] = _secondmdate )
)
RETURN
_mamount - _smamount
If the above one is not working for you, please provide some sample data(exclude sensitive data) with Text format and your expected result with special examples and screenshots. It is better if you can provide me a simplified pbix file. Thank you.
Best Regards
Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.