Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
LRSFC_DanJ
Regular 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 viewing Attribute on X axis vs Value on Y axis for a specific date, like this:

 

LRSFC_DanJ_0-1673446349327.png

Is there a way to make this so that two different dates can be selected, and they will appear as side-by-side columns? Not a date range, but 2 different individual dates? I tried adding the Date field as a Legend to the chart but this just made it show up as a blue dot at the top with the date on it.

I did see a post at https://community.powerbi.com/t5/Desktop/Two-slicer-on-same-column/m-p/516318 which seemed similar but I could not understand how I could apply the solution posted there to my own situation, as it's not just a single number that I want to compare and I want a column graph rather than a pie chart.

EDIT: alternatively if the above is not possible then being able to see the same day (e.g. April 2nd) selectable from a slicer but with different years (selectable with another slicer) would also be useful.

1 ACCEPTED SOLUTION
LRSFC_DanJ
Regular Visitor

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.

LRSFC_DanJ_0-1673623442242.png

 

View solution in original post

2 REPLIES 2
LRSFC_DanJ
Regular Visitor

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.

LRSFC_DanJ_0-1673623442242.png

 

Anonymous
Not 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:

vtangjiemsft_0-1673509764600.png

(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.

vtangjiemsft_1-1673510075177.png

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. 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.