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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
jmpmolegraaf
Frequent Visitor

Measure only showing values when column equals a dedicated text

Hello all,

 

thanks in advance for your time to help me as I got stuck after attempting various "solutions"

I have the following visual table:

 

jmpmolegraaf_0-1739262040838.png

and these three measures:

UMlnbv =

IF(
    NOT ISBLANK([CVlnbv]),
    CALCULATE(
        LASTNONBLANKVALUE(
            UpstreamMargins[Attribute],
            SUM(UpstreamMargins[Value])
            ),
        _Calendar[Date] <= MAX(_Calendar[Date])
    )
)

CVlnbv =
CALCULATE(
    LASTNONBLANKVALUE(
        PurchasePrices[ApplDate],
        SUM(PurchasePrices[CostValue (USD/HL)])
        ),
    _Calendar[Date] <= MAX(_Calendar[Date])
)

 

CV-UM = [CVlnbv] - [UMlnbv]

basically, I have the following needs:
- I only want to see a value for [UMlnbv] when CostCategory = "ADD" (it's a calculated column in the table PurchasePrices)
- the measure [CV-UM] should only deduct by the [UMlnbv] when CostCategory = "ADD"


please note that we do not have values for every date, hence me using lastnonblankvalue.

could someone help me? 🙂
thanks in advance!



 

 

3 REPLIES 3
Anonymous
Not applicable

Hi @jmpmolegraaf 

 

Please try this:

UMlnbv =
VAR _outcome =
    IF (
        NOT ISBLANK ( [CVlnbv] ),
        CALCULATE (
            LASTNONBLANKVALUE ( UpstreamMargins[Attribute], SUM ( UpstreamMargins[Value] ) ),
            _Calendar[Date] <= MAX ( _Calendar[Date] )
        )
    )
RETURN
    IF ( SELECTEDVALUE ( PurchasePrices[CostCategory] ) = "ADD", _outcome )
CV-UM =
IF (
    SELECTEDVALUE ( PurchasePrices[CostCategory] ) = "ADD",
    [CVlnbv] - [UMlnbv]
)

 

Hope this can help,

 

Best Regards

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

bhanu_gautam
Super User
Super User

@jmpmolegraaf , Try using

 

This measure will only return a value when CostCategory is "ADD".
DAX
UMlnbv =
IF(
NOT ISBLANK([CVlnbv]) && MAX(PurchasePrices[CostCategory]) = "ADD",
CALCULATE(
LASTNONBLANKVALUE(
UpstreamMargins[Attribute],
SUM(UpstreamMargins[Value])
),
_Calendar[Date] <= MAX(_Calendar[Date])

 

CV-UM: This measure will only deduct by the UMlnbv when CostCategory is "ADD".
DAX
CV-UM =
IF(
MAX(PurchasePrices[CostCategory]) = "ADD",
[CVlnbv] - [UMlnbv],
[CVlnbv]
)


These modifications ensure that the UMlnbv measure only shows values when the CostCategory is "ADD" and that the CV-UM measure only performs the deduction when the CostCategory is "ADD"




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






dear bhanu,

yes i tried that before, see below the effect of the "TEST" measure you gave.
basically it does not generate "lastnonblankvalues", i.e. it does not fill down the value anymore.
it only shows a value where there is actually a value on the exact date, in the table PurchasePrices.
for the subsequent dates, there is no entry in PurchasePrices but still need to see the value.

jmpmolegraaf_0-1739262915559.png

 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.

Top Solution Authors