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 September 15. Request your voucher.

Reply
NMDGA
Frequent Visitor

Dynamic Measure calculation

Hi team ,

 i am learning powerbi dax and i am facing difficulty in designing an approach for this implementation: 
i have a table with report date , product, activeflag and amount . When i select a date value from report date which is used as slicer i want to get all the rows displayed in a table visual which are tagged to the selected date + the rows that have date < selected date but with active flag ='Y' . Eg . If i have selected 2 aug in my slicer i should display all records belonging to 2 aug + plus active rows from 1 aug and 31 july + 30 july  etc . If i select 1 aug in slicer i should be displaying all rows from 1 aug plus only active rows from 31 july , 30 july etc .  

1 ACCEPTED SOLUTION
Anonymous
Not applicable

lbendlin , thanks for your concern about this case. I tried to create a sample data myself based on the user's requirement and implemented the result. Please check if there is anything that can be improved. Here is my solution:
Hi  @NMDGA ,

I created some data:

vyangliumsft_0-1724220892899.png

Here are the steps you can follow:

When the same columns are used in the slicer and the table visual, then the table visual will change with the values selected by the slicer, and we can create a table of dates with no relationship to work with measure

1. Create calculated table.

Date =
CALENDAR(
    DATE(2024,7,1),
    DATE(2024,10,31))

vyangliumsft_1-1724220892902.png

2. Create measure.

Flag =
var _select=SELECTEDVALUE('Date'[Date])
return
IF(
    MAX('Table'[report date])=_select ||
    AND(
        MAX('Table'[report date])<_select,MAX('Table'[activeflag])="Y"),1,0)

3. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_2-1724220963170.png

4. Result:

 

vyangliumsft_3-1724220963177.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

lbendlin , thanks for your concern about this case. I tried to create a sample data myself based on the user's requirement and implemented the result. Please check if there is anything that can be improved. Here is my solution:
Hi  @NMDGA ,

I created some data:

vyangliumsft_0-1724220892899.png

Here are the steps you can follow:

When the same columns are used in the slicer and the table visual, then the table visual will change with the values selected by the slicer, and we can create a table of dates with no relationship to work with measure

1. Create calculated table.

Date =
CALENDAR(
    DATE(2024,7,1),
    DATE(2024,10,31))

vyangliumsft_1-1724220892902.png

2. Create measure.

Flag =
var _select=SELECTEDVALUE('Date'[Date])
return
IF(
    MAX('Table'[report date])=_select ||
    AND(
        MAX('Table'[report date])<_select,MAX('Table'[activeflag])="Y"),1,0)

3. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_2-1724220963170.png

4. Result:

 

vyangliumsft_3-1724220963177.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

lbendlin
Super User
Super User

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information or anything not related to the issue or question.

If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

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.