Forum Discussion
Retrieve just one quote
- 7 years ago
Hi Anonymous
You can create a Measure like below, and use it later as Filters in your Table visual.
Measure = VAR _firstQuoteID = { CALCULATE( MAX( Quotes[qtID] ), ALL( Quotes[qtID] ) ) } RETURN CALCULATE( COUNTROWS( Quotes ), KEEPFILTERS( TREATAS( _firstQuoteID, Quotes[qtID] ) ) )The attached file contains an applied solution.
Best Regards,
Mariusz
If this post helps, then please consider Accepting it as the solution.
Please feel free to connect with me.
Hello Mariusz,
Please see below for my test data in a table:
As you can see, I have here two Quotes under 1 Opportunity. The requirement is just to diplay the first Quote if there are 2 or more Quotes linked to an Opportunity. Is it possible to do it using DAX?
Regards,
Maverick423
Hi Anonymous
You can create a Measure like below, and use it later as Filters in your Table visual.
Measure =
VAR _firstQuoteID = { CALCULATE( MAX( Quotes[qtID] ), ALL( Quotes[qtID] ) ) }
RETURN
CALCULATE(
COUNTROWS( Quotes ),
KEEPFILTERS( TREATAS( _firstQuoteID, Quotes[qtID] ) )
)
The attached file contains an applied solution.
Mariusz
If this post helps, then please consider Accepting it as the solution.
Please feel free to connect with me.
- Anonymous7 years agoNot applicable
Hi Mariusz,
Thank you ever so much for this. You're a genius!!
It solved my problem instantly:)
Regards,
Maverick423
- Anonymous7 years agoNot applicable
Hi Mariusz,
Just an additional question for this. When I tried to add more fields in the table like Opp Name and Quote Name, the visual filter will stop working. I tried to replicate the Measure using Opp Name and Quote Name but they did not work.
Thanks again.
Regards,
Maverick423
- Mariusz7 years ago
Community Champion
Hi Anonymous
The adjusted version should work, please see the below code and the attached file.
The problem was that the Quote Name column was not included in the ALL() statement and the filter context was still applied.
Measure = VAR _firstQuoteID = { CALCULATE( MAX( Quotes[qtID] ), ALL( Quotes ), VALUES( Quotes[OppID] ) ) } RETURN CALCULATE( COUNTROWS( Quotes ), KEEPFILTERS( TREATAS( _firstQuoteID, Quotes[qtID] ) ) )Best Regards,
Mariusz
If this post helps, then please consider Accepting it as the solution.
Please feel free to connect with me.