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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
curtismob
Helper IV
Helper IV

Using the First Value Of a Group

Hello,

Below is what I am trying to accomplish.

  • Use the cost for the first vendor in the grouping, where the "As Of" date selected falls w/in the Effective/Expiration range.
  • Grouping is by Category/Subcategory/Cost Code
  • Needs to work with the slicer selections
  • Tried RANKX and TOPN, neither with the desired results.

I have the pbix for the example below, but not sure how to post it.

 

curtismob_0-1646336133269.png

 

Thanks in advance,

@curtismob 

 

8 REPLIES 8
curtismob
Helper IV
Helper IV

@V-lianl-msft,

I tried your suggestion, thank you!!  It is close but doesn't work when the date selected is changed to include the older effective/expiration date range.  The older date range cost is included in the first screen print, but see the second screen print and what happens when I add Measure 2 to the grid.

 

Before adding Measure 2 to the grid:

curtismob_0-1646928574495.png

 

After adding Measure 2 to the grid:

 

curtismob_1-1646928859661.png

 

 

Hi ,

 

Please apply it to visual level filter not put it into table visual.

Vlianlmsft_0-1647334052419.png

 


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

Hi, I did have the visual filter set to 1 for Measure 2, but unfortunately it still doesn't work when the as of date is changed from 2/1/2022 to 1/12/2022.  The cost for cost code 1234 should change from $250 to $150 instead.

curtismob
Helper IV
Helper IV
PijushRoy
Super User
Super User

Hi @curtismob 

 

Please upload pbix file in google drive, make any one can access it and share the link here

Hi @PijushRoy,

 

I have shared the Google Drive link.

 

Thank you,

@curtismob 

Hi @curtismob ,

 

Try to create a measure like below and apply it to visual level filter:

Measure 2 =
var rank_ =
RANKX (
ALLEXCEPT( Cost,Cost[CostCode] ),
[Measure Cost AsOf]
)
var min_vendor = CALCULATE(MIN(Cost[VendorNo]),FILTER(ALLSELECTED(Cost),Cost[CostCode]=MAX(Cost[CostCode])))
return IF(rank_=1&&MAX(Cost[VendorNo])=min_vendor,1,0)

Vlianlmsft_0-1646722078837.png

 

 

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

Hi @V-lianl-msft,

Thank you for the response, I'm not sure why I wasn't notified you reponded.  I will give this a try and update this thread.

 

@curtismob 

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.