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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
gpuc09_
Regular Visitor

Merge measures into column for filtering data

Hi guys! Can anyone answer a question about power bi?

I have a table with a date column. I need to solve a problem as follows:

1- A filter must be created to select the date.
2- The dashboard should filter the table with the value of that date and with the value of the previous day.
- In other words:
- If the user has selected the day 30-08-2024, it should show the data referring to the day 30-08-2024 and 29-08-2024

This column with the two dates will be used to filter another table based on the data collected.

I don't know how to do this, so if someone could help, that would be great!

Translated with DeepL.com (free version)



gpuc09__0-1729269007455.png

 

1 ACCEPTED SOLUTION

Hey @gpuc09_ ,

No worries! I’ve put together a DAX measure that calculates and displays the values for both the selected date and the previous date. Take a look at the attached image and file to see how it works. Hope it helps!

marcelsmaglhaes_2-1729546925285.png

 

 


Regards,
Marcel Magalhães
Microsoft Power BI Official Partner
MCT | Certified PL-300 Power BI

If I've helped, don't forget to mark my post as a solution!



View solution in original post

3 REPLIES 3
gpuc09_
Regular Visitor

Hello @marcelsmaglhaes!


Thanks for your help, but it's not exactly what I wanted... Let me see if I can be more specific and send you a draft of the dashboard!


Suppose I have this data (Image 01), where I have several values for the dates from October 1st to October 10th. When I create a filter, with a single selection, of the dates present in my column (Image 02), I need the table to show the values of that selected date and the previous day, in separate rows (Image 03).


I think it's clearer this way! If you can edit the draft to get the result, that would be great!


Thank you very much! 

Dataset values:

data,value
2024-10-01,213
2024-10-02,245
2024-10-02,113
2024-10-02,105
2024-10-03,318
2024-10-03,187
2024-10-04,373
2024-10-04,325
2024-10-04,188
2024-10-05,261
2024-10-05,122
2024-10-05,357
2024-10-06,363
2024-10-07,380
2024-10-08,150
2024-10-08,420
2024-10-09,391
2024-10-10,380

gpuc09__0-1729476188756.png

 

gpuc09__1-1729476188714.png

 

image.png

 

Hey @gpuc09_ ,

No worries! I’ve put together a DAX measure that calculates and displays the values for both the selected date and the previous date. Take a look at the attached image and file to see how it works. Hope it helps!

marcelsmaglhaes_2-1729546925285.png

 

 


Regards,
Marcel Magalhães
Microsoft Power BI Official Partner
MCT | Certified PL-300 Power BI

If I've helped, don't forget to mark my post as a solution!



marcelsmaglhaes
Super User
Super User

 

Hey @gpuc09_ 

To achieve this in Power BI, you can create a measure that dynamically selects both the chosen date and the previous day. See the example below. The approach uses the var selecteddate and pday (previous day's date)  to adjust the data context accordingly

 

marcelsmaglhaes_0-1729279892849.png

 


Regards,
Marcel Magalhães
Microsoft Power BI Official Partner
MCT | Certified PL-300 Power BI

If I've helped, don't forget to mark my post as a solution!



Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors