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
Analitika
Post Prodigy
Post Prodigy

Lines amount in visual depending on selected years in Power BI

Hi,

 

I would like to ask how change my measure that will appear different lines according to selected year in slicer. My visual looks like this:

 

Analitika_0-1665130628875.png

Visual type is like this:

Line and clustered column chart.

Measure look like this:

 

Pardavimai santykis_h = 
var metu_uzdarymo_pozymis=[ABC_Metu_uzdarymo_ZU0_KOD]
var valandos= CALCULATE([kiekis_h], all('Sas kod unik BRIDGE'[POZYMIAI Veiklu (Excel AUTO)]),all('Sas kod unik BRIDGE'[Sąskaitos pavadinimas]), all('Sas kod unik BRIDGE'[Pajamu sanaudu vaizdavimas (PAVADINIMAI)]),ALL('DBA view_DidknObj'[DID_NR]),ALL('DBA view_DidknObj'[DID_DAT]),ALL('DBA view_DidknObj'[OBJ_KOD]),ALL('DBA view_DidknObj'[Saskaitos numeris]),ALL('DBA klient_tiekejai'[kli_pav]))
/*var savikaina= sumx(FILTER('DBA view_DidknObj', RELATED('Sas kod unik BRIDGE'[POZYMIAI Veiklu (Excel AUTO)])="Savikaina"&&Find(metu_uzdarymo_pozymis,'DBA view_DidknObj'[ZU0_KOD],,0)=0), 'DBA view_DidknObj'[SUM_DEB]-'DBA view_DidknObj'[SUM_CRE])*/
return


if([kiekis_h]=BLANK(),"",DIVIDE([_2_1_1_Pardavimai (priklauso nuo vienetų pasirinkimo)],valandos))

Now I have situation that there is a line which is being aggregated according to selected years in slicer.

4 REPLIES 4
v-stephen-msft
Community Support
Community Support

Hi @Analitika ,

 

Probably because you used the ALL function and ignored the slicer selection for the year.

It is recommended that you replace the ALL function with the ALLSELECTED function.

ALLSELECTED function (DAX) - DAX | Microsoft Learn

 

 

 

Best Regards,

Stephen Tao

 

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

 

Where I have to put that allselected? At the end of the measure?

 

Hi @Analitika ,

 

Please try

Pardavimai santykis_h =
VAR metu_uzdarymo_pozymis = [ABC_Metu_uzdarymo_ZU0_KOD]
VAR valandos =
    CALCULATE (
        [kiekis_h],
        ALLSELECTED( 'Sas kod unik BRIDGE'[POZYMIAI Veiklu (Excel AUTO)] ),
        ALLSELECTED( 'Sas kod unik BRIDGE'[Sąskaitos pavadinimas] ),
        ALLSELECTED( 'Sas kod unik BRIDGE'[Pajamu sanaudu vaizdavimas (PAVADINIMAI)] ),
        ALLSELECTED( 'DBA view_DidknObj'[DID_NR] ),
        ALLSELECTED( 'DBA view_DidknObj'[DID_DAT] ),
        ALLSELECTED( 'DBA view_DidknObj'[OBJ_KOD] ),
        ALLSELECTED( 'DBA view_DidknObj'[Saskaitos numeris] ),
        ALLSELECTED( 'DBA klient_tiekejai'[kli_pav] )
    ) /*var savikaina= sumx(FILTER('DBA view_DidknObj', RELATED('Sas kod unik BRIDGE'[POZYMIAI Veiklu (Excel AUTO)])="Savikaina"&&Find(metu_uzdarymo_pozymis,'DBA view_DidknObj'[ZU0_KOD],,0)=0), 'DBA view_DidknObj'[SUM_DEB]-'DBA view_DidknObj'[SUM_CRE])*/
RETURN
    IF (
        [kiekis_h] = BLANK (),
        "",
        DIVIDE ( [_2_1_1_Pardavimai (priklauso nuo vienetų pasirinkimo)], valandos )
    )

 

 

Best Regards,

Stephen Tao

 

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

 

It makes same result, nothing changed.

 

Analitika_0-1665467775184.png

 

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.