- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
List selected values in table/measure - Urgent!
Hello -
I am choosing any 2 dates from a slicer, and getting cost for: prior date and current date. But, when there is no data or cost in prior date the prior cost is being filled with current cost - this is incorect, the prior cost should stay empty.
What is the correction required for below DAX?
Calculate_PRIOR_PERIOD_VALUE =
VAR _selectedDates = VALUES(F_W_S_COST[TIME_FRAME])
VAR _priorperiod = MINX(FIRSTNONBLANK(_selectedDates,1),[TIME_FRAME])
VAR _prior_value = ROUND(CALCULATE([Calc_COST],F_W_SCOST[TIME_FRAME] = _priorperiod),4)
Return _prior_value
Calculate_CURR_PERIOD_VALUE =
VAR _selectedDates = VALUES(F_W_S_COST[TIME_FRAME])
VAR _currperiod = MAXX(LASTNONBLANK(_selectedDates,1),[TIME_FRAME])
VAR _curr_value = ROUND(CALCULATE([Calc_COST],F_W_SCOST[TIME_FRAME] = _priorperiod),4)
Return _curr_value
My guess is the varaible that includes FIRSTBLANK & LASTBLANK are incorrect. How to distinguish prior date and current date?
P.S: cannot use the LASTDATE and FIRSTDATE function as the this is a TEXT column containing actuals dates, 2021Q1, 2021H1
Thanks,
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@spartanboy , not very clear, the measure should be
Current =
var _max = maxx(allselected(Date),Date[Date])
var _min = minx(allselected(Date),Date[Date])
return
calculate( sum(Table[Value]), filter('Date', 'Date'[Date] =_max))
Last =
var _max = maxx(allselected(Date),Date[Date])
var _min = minx(allselected(Date),Date[Date])
return
if(_max= _min, blank(), calculate( sum(Table[Value]), filter('Date', 'Date'[Date] =_min)) )
Refer if needed
-Power BI Abstract Thesis: How to use two Date/Period slicers
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@spartanboy , not very clear, the measure should be
Current =
var _max = maxx(allselected(Date),Date[Date])
var _min = minx(allselected(Date),Date[Date])
return
calculate( sum(Table[Value]), filter('Date', 'Date'[Date] =_max))
Last =
var _max = maxx(allselected(Date),Date[Date])
var _min = minx(allselected(Date),Date[Date])
return
if(_max= _min, blank(), calculate( sum(Table[Value]), filter('Date', 'Date'[Date] =_min)) )
Refer if needed
-Power BI Abstract Thesis: How to use two Date/Period slicers
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
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - January 2025
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
Subject | Author | Posted | |
---|---|---|---|
08-01-2024 07:46 AM | |||
Anonymous
| 07-03-2024 03:42 PM | ||
06-12-2024 12:52 AM | |||
08-12-2024 10:10 PM | |||
08-06-2024 10:28 PM |
User | Count |
---|---|
118 | |
75 | |
46 | |
44 | |
34 |
User | Count |
---|---|
180 | |
85 | |
68 | |
47 | |
46 |