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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
mohammadrafic
Helper I
Helper I

Future date with latest data

hi,

i have card visual and date between slicer. when i select future date it should show the last day data in card visual.

my table i have date and data columns but for the future date i dont have data because it is forecast data.  please solve this issue. thanks

 

mohammadrafic_0-1627881682544.png

 

1 ACCEPTED SOLUTION
v-xiaotang
Community Support
Community Support

Hi @mohammadrafic 

Based on your sample data, I create a sample. See sample file attached bellow.

-

coz you want put values into card, in card there's no row context so you need to provide context to filter manually in measure,

Measure = 
var _currentMonth=CALCULATE(MAX('Table'[StartDate]),ALL('Table'))
var _selMonth=SELECTEDVALUE(dateSlicer[StartDate])
var _lastMonth=EDATE(_currentMonth,-1)
var _YTD1=CALCULATE(MAX('Table'[Forecast_YTD_AVG]),FILTER(ALL('Table'),'Table'[StartDate]=_lastMonth&&'Table'[TITLE]="Light-Total"))
var _YTD2=CALCULATE(MAX('Table'[Forecast_YTD_AVG]),FILTER(ALL('Table'),'Table'[StartDate]=_lastMonth&&'Table'[TITLE]="PZ-Total"))
var _YTD3=CALCULATE(MAX('Table'[Forecast_YTD_AVG]),FILTER(ALL('Table'),'Table'[StartDate]=_lastMonth&&'Table'[TITLE]="Ratawi-Total"))
var _YTD4=CALCULATE(MAX('Table'[Forecast_YTD_AVG]),FILTER(ALL('Table'),'Table'[StartDate]=_lastMonth&&'Table'[TITLE]="SUGAMT-Total"))
return
"Light-Total: "&_YTD1&"   PZ-Total: "&_YTD2&"   Ratawi-Total: "&_YTD3&"   SUGAMT-Total: "&_YTD4

result

vxiaotang_0-1628058013797.png

 

Best Regards,

Community Support Team _Tang

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

View solution in original post

4 REPLIES 4
v-xiaotang
Community Support
Community Support

Hi @mohammadrafic 

Based on your sample data, I create a sample. See sample file attached bellow.

-

coz you want put values into card, in card there's no row context so you need to provide context to filter manually in measure,

Measure = 
var _currentMonth=CALCULATE(MAX('Table'[StartDate]),ALL('Table'))
var _selMonth=SELECTEDVALUE(dateSlicer[StartDate])
var _lastMonth=EDATE(_currentMonth,-1)
var _YTD1=CALCULATE(MAX('Table'[Forecast_YTD_AVG]),FILTER(ALL('Table'),'Table'[StartDate]=_lastMonth&&'Table'[TITLE]="Light-Total"))
var _YTD2=CALCULATE(MAX('Table'[Forecast_YTD_AVG]),FILTER(ALL('Table'),'Table'[StartDate]=_lastMonth&&'Table'[TITLE]="PZ-Total"))
var _YTD3=CALCULATE(MAX('Table'[Forecast_YTD_AVG]),FILTER(ALL('Table'),'Table'[StartDate]=_lastMonth&&'Table'[TITLE]="Ratawi-Total"))
var _YTD4=CALCULATE(MAX('Table'[Forecast_YTD_AVG]),FILTER(ALL('Table'),'Table'[StartDate]=_lastMonth&&'Table'[TITLE]="SUGAMT-Total"))
return
"Light-Total: "&_YTD1&"   PZ-Total: "&_YTD2&"   Ratawi-Total: "&_YTD3&"   SUGAMT-Total: "&_YTD4

result

vxiaotang_0-1628058013797.png

 

Best Regards,

Community Support Team _Tang

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

Hi v-xiaotang. Great it works your idea. but i fixed through oracle sql fill the data till end of the year bcz i need complete year. thank you.

 
LAST_VALUE (FORECAST_YTD_AVG)
IGNORE NULLS
OVER (PARTITION BY table_name
ORDER BY table_name, start_date
ROWS BETWEEN UNBOUNDED PRECEDING AND 0 PRECEDING)
FORECAST_YTD_AVG
mohammadrafic
Helper I
Helper I

in july i dont have data which is highlighted in yellow but when i select july in slicer i wanted to see. it should use the last value which is june data. and i am not using date table that is not required here.

 

mohammadrafic_0-1627884268288.png

 

amitchandak
Super User
Super User

@mohammadrafic , Not very clear. Can you explain with an example? Make sure you are using the date table and the Date table has that future date.

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.