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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Mahi1827
Resolver I
Resolver I

Need help to show dates which are greater than max date from selected data range from 1 date slicer

i am using one date slicer "prodcutdate" with date range, as per selected date range i have 2 requirements to display results in table view


1) showing product dates between selected date range.. product date used in date slicer ( this is working fine)

if we select date slicer between 1/15/2020 to 3/31/2020, records displayed in table view as below and its working fine.

Productid   Product date,   Prodcut reviewdate, Product service date
1001,         01-15-2020      01-16-2020               01-31-2020
1002,        02-25-2020       02-26-2020               02-28-2020
1003,        03-31-2020       03-21-2020               03-25-2020

 

Need help on to get solution to 2nd requirement


2) as per above, if i select same date range 1/15/2020 to 3/31/2020, then i need to display Prodcut reviewdate,Product service date columns from same table
those date values >=3/31/2020, means max date from selected date range. i need to display expected results in separate table view like below


future_Prodcut reviewdate, future_Product service date
04-01-2020                          05-31-2020
05-22-2020                          07-15-2020
06-30-2020                          08-24-2020


to achive this iam trying with creatig 2 measures one for Prodcut reviewdate and one for Product service date like below
intially iam trying with creating measure for Prodcut reviewdate

 

Future_prodcutreviewdate= var v_max=maxx(Allselected('prodcuts'),prodcuts'[Product date]) //product date used in date slicer//

return

calculate(selectedvalue([Prodcutreviewdate]),filter(Allseelcted(prodcuts),prodcuts[[Prodcutreviewdate]>=v_max)


by using above measure iam placing it in table but iam getting only one date result that too its from selected date range 3/31/2020 in all result columns.

 

so above logic not working as expected.Also i tried with options in return statement with 1) Allselected 2) Selectedvalue 3) HASONEVALUE 4)values but not getting expected output.


So please help me with dates which are greater than max date from selected data range to achieve expected output like above in 2nd requirement.


please sugegst by changing logic in measure or any other alternatives to get exepcted output. so i will use same logic for future_Product service date.


Thank you in advance for your help.


Thanks
Mahi18

1 ACCEPTED SOLUTION

Hi 

 

     Future_prodcutreviewdate= var v_max=maxx(Allselected('Date'),'Date'[Date])
     return

     calculate(selectedvalue([Prodcutreviewdate]),filter(all('Date'),'Date'[Date]>=v_max))

 

    The new created measure has worked like a charm..

 

 

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@Mahi1827 , Move the date to date table. If You use all on the same table then it will remove filter .

 

Future_prodcutreviewdate= var v_max=maxx(Allselected('Date'),'Date'[Date]) //product date used in date slicer//
return

calculate(selectedvalue([Prodcutreviewdate]),filter(all('Date'),'Date'[Date]>=v_max))

 

Refer how join same date table with multiple dates

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

See if my webinar on Time Intelligence can help: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-Y...


Appreciate your Kudos.

Hi amitchandak ,


 Thank you so much for your response, as you suggested i have changed datamodel.

Date is coming from Calender table Date which is used in date slicer. Product date, Product review date coming from Products table . so here relations is product date mapped to date in Date table.

 

finally in date slicer i am taking "date" from date table.

for table view created new measure as you suggested 

 

Future_prodcutreviewdate= var v_max=maxx(Allselected('Date'),'Date'[Date])
return

calculate(selectedvalue([Prodcutreviewdate]),filter(all('Date'),'Date'[Date]>=v_max))

 

but while using selected value or allselected,  i am getting all records without comparing any max value from measure.

 

could you please suggest modified measure as per new data model?

 

Thank you,

Mahi18

 

Hi 

 

     Future_prodcutreviewdate= var v_max=maxx(Allselected('Date'),'Date'[Date])
     return

     calculate(selectedvalue([Prodcutreviewdate]),filter(all('Date'),'Date'[Date]>=v_max))

 

    The new created measure has worked like a charm..

 

 

v-yiruan-msft
Community Support
Community Support

Hi  @Mahi1827 ,

Please review the solution in the below thread and check if it will help you:

 

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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