Forum Discussion
LRSFC_DanJ
3 years agoRegular Visitor
Compare data from 2 dates side by side?
In the Power BI report I am currently working with I have unpivoted data with columns Attribute, Date and Value. Currently I have a report page with a column graph having a date slicer allowing viewi...
- 3 years ago
The solution we arrived at in the end was to create 3 new columns as follows:
Year = YEAR('Unpivoted Data'[Date]) Week = WEEKNUM('Unpivoted Data'[Date],2) Weekday = SWITCH(WEEKDAY('Unpivoted Data'[Date],2),1,"1. Monday",2,"2. Tuesday",3,"3. Wednesday",4,"4. Thursday",5,"5. Friday",6,"6. Saturday",7,"7. Sunday")We were then able to put the Year column into the chart's legend and a multi-select slicer and the Week and Weekday columns as single-select slicers.
Anonymous
3 years agoNot applicable
Hi LRSFC_DanJ ,
According to your description, you want to display the values of two selected dates side by side in a bar chart.
(1)Here is my test data:
(2)We can create two measures:
Min Date Value =
VAR _min_date =
MIN ( 'Table'[Date] )
VAR _cur_time =
MAX ( 'Table'[Time] )
VAR _t =
FILTER (
ALL ( 'Table' ),
'Table'[Date] = _min_date
&& 'Table'[Time] = _cur_time
)
VAR _date_count =
COUNTROWS ( VALUES ( 'Table'[Date] ) )
RETURN
IF ( _date_count > 1, SUMX ( _t, [Value] ), BLANK () )
Max Date Value =
VAR _max_date =
MAX ( 'Table'[Date] )
VAR _cur_time =
MAX ( 'Table'[Time] )
VAR _t =
FILTER (
ALL ( 'Table' ),
'Table'[Date] = _max_date
&& 'Table'[Time] = _cur_time
)
RETURN
SUMX ( _t, [Value] )
Then we put her in the visual to fulfill your needs.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.