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
Victormar
Helper IV
Helper IV

Measure returning multiple values based on slicer selection

Hello community!

I am working on a measure which I would like to return the different values for "expiring contract date" based on a slicer selection for the vehicles in every fleet.

Ideally, the user would select a fleet and then the different expiring dates for each vehicle would show.

 

I have been working with: 

Expiry Date = if(
    ISFILTERED(DIM_Chassis[FLEET]),
    VALUES(DIM_Chassis[CONTRACT_EXPIRING_DATE]),
    blank()
    )
But doesn't work when there are different expiring dates
I think it's not possible, but still want to try.
 
Thanks! 🙂
1 ACCEPTED SOLUTION

@Victormar 

I see. 

 

Caz_16_0-1666276137627.png

 

Caz_16_1-1666276141758.png

 

Does this look ok? In a Matrix visual, I put the "Fleet" at the Primary Row and the "Expiration Date" as the Sub Row. Ive attached my .pbix file at the OneDrive link. Link to OneDrive 

 

I guessed at how your data is formatted. You may be able to put your data into a summary table to get it to behave like this. 

 

View solution in original post

6 REPLIES 6
Victormar
Helper IV
Helper IV

Hello,

You didn't understand me, I don't want to add the trucks as a row in the matrix, that is my problem to show the different expiring dates.

Ideally I would like to return the different expiring dates from the measure without having to add the trucks, and I am not sure it is possible, something like that:

Victormar_1-1666249332367.png

I am only adding the measures as values in the matrix.

@Victormar 

I see. 

 

Caz_16_0-1666276137627.png

 

Caz_16_1-1666276141758.png

 

Does this look ok? In a Matrix visual, I put the "Fleet" at the Primary Row and the "Expiration Date" as the Sub Row. Ive attached my .pbix file at the OneDrive link. Link to OneDrive 

 

I guessed at how your data is formatted. You may be able to put your data into a summary table to get it to behave like this. 

 

Thanks for the explanation! That helped 😄

Caz_16
Helper II
Helper II

 

Expiriation Date =
IF(
    HASONEVALUE(
        [Fleet]
    ),
    [Expiration Date],
    BlANK()
)

 

 

 

Expiriation Date =
IF(
    COUNTROWS(
        [Fleet]
    ) = 1,
    [Expiration Date],
    BlANK()
)

 

Have you tried HASONEVALUE([Fleet]) or COUNTROWS([Fleet]) = 1? If you put this in the conditional parameter of IF(), then the measure should evaluate when the conditional is TRUE. 

 

Also keep in mind that Measures are designed to return a single value. How you display the measure can alter how the measure behaves. If you want to display this in a table like below, then the above measure should work. 

TruckExp. Date

Truck 1

1/1/22
Truck 24/1/22
Truck 37/1/22

 

Hello, and thanks for the reply 🙂

I have tried but I get this error:

Victormar_0-1666186924863.png

Maybe the problem is that I am using the measures in a matrix as values, so I only show the result of the measures?

 

Not sure from the formulas you shared though, after HASONEVALUE or COUNTROWS, Expiring_Date has to be a measure right? Cannot pass a column there (expiring_date is a column in my dataset).

 

Hope it makes sense 😄

@Victormar 

First https://gprivate.com/61eoy 

Second, for the second parameter of your IF() statement should be a measure that returns the Expiration date of each truck. You can use an aggregate function in your measure such as MIN, MAX, FIRSTNONBLANK, to get the appropriate Expiration date for each truck. The other route to go would be to create a calculated column in the appropriate table. If you go with this method, then IF() can reference a column and return a value. 

 

When creating measures, a great way to troubleshoot what it is doing is to put the measure in a table and add columns to see how the measure is being evaluated in row context. 

 

Hope this helps. 

Caz

 

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.