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
cdesseaux
Frequent Visitor

sales date not appearing - context transition

Hi, 

 

I have a visualization that shows sales cancellations per month. 

cdesseaux_0-1628103415904.png

Measure used is the following:

Distratos por data distrato = calculate (distinctcount('setelm_bi reservas_historicos_situacoes'[idreserva]),
'setelm_bi reservas_historicos_situacoes'[para_nome]="Distrato")
 
Drilling down on july, I get the following table:
cdesseaux_1-1628103482485.png

Id and cancellation date (data distrato) are as expected, but sales date (data venda distrato) only shows the one date that's within july. Measure used is:

Data venda distrato = calculate(max('setelm_bi reservas_historicos_situacoes'[Data cadastro]),
all('CalendarTableAlt'[MesAno abr]),
'setelm_bi reservas_historicos_situacoes'[para_nome]="Venda finalizada")
 
I used ALL to clear the filter on the month that came from the visualization, but it seems to have no effect. I'd be very grateful if anyone could help out...

Regards, 
Christophe
1 ACCEPTED SOLUTION
v-yiruan-msft
Community Support
Community Support

Hi @cdesseaux ,

Could you please share some sample data(exclude sensitive data) and your expected result with calculation logic and special examples in order to provide you a suitable solution? As checked the formula of measure [Data venda distrato], it will only return only max [Data cadastro] even though you used ALL function in table 'CalendarTableAlt'[MesAno abr]... Do you want to get all dates which filter the conditions or something else? 

Please try to update the formula of measure [Data venda distrato] as below and check whether it can return the correct result.

Data venda distrato =
CALCULATE (
    MAX ( 'setelm_bi reservas_historicos_situacoes'[Data cadastro] ),
    FILTER (
        ALL ( 'setelm_bi reservas_historicos_situacoes' ),
        'setelm_bi reservas_historicos_situacoes'[idreserva]
            = SELECTEDVALUE ( 'setelm_bi reservas_historicos_situacoes'[idreserva] )
            && 'setelm_bi reservas_historicos_situacoes'[para_nome] = "Venda finalizada"
    )
)

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
cdesseaux
Frequent Visitor

Hi @v-yiruan-msft 

That worked perfectly, thanks a lot!

v-yiruan-msft
Community Support
Community Support

Hi @cdesseaux ,

Could you please share some sample data(exclude sensitive data) and your expected result with calculation logic and special examples in order to provide you a suitable solution? As checked the formula of measure [Data venda distrato], it will only return only max [Data cadastro] even though you used ALL function in table 'CalendarTableAlt'[MesAno abr]... Do you want to get all dates which filter the conditions or something else? 

Please try to update the formula of measure [Data venda distrato] as below and check whether it can return the correct result.

Data venda distrato =
CALCULATE (
    MAX ( 'setelm_bi reservas_historicos_situacoes'[Data cadastro] ),
    FILTER (
        ALL ( 'setelm_bi reservas_historicos_situacoes' ),
        'setelm_bi reservas_historicos_situacoes'[idreserva]
            = SELECTEDVALUE ( 'setelm_bi reservas_historicos_situacoes'[idreserva] )
            && 'setelm_bi reservas_historicos_situacoes'[para_nome] = "Venda finalizada"
    )
)

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.