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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Analitika
Post Prodigy
Post Prodigy

Adding lines in visual which corresponds to year in Power BI

Hi,

 

I would like to ask how make that visual will contain separate lines according to selected year. Now I have a measure:

 

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))

 

Here is a visual:

Analitika_0-1665381978434.png

Green line shows data summing two years, it is general line. I need to make that if I select two year, then two lines appear in visual according to years, for example, in this case: 2021 and 2022 line of same measure. How I could achieve this? Visual type is -  Line and clustured column chart.

 

2 REPLIES 2
v-yanjiang-msft
Community Support
Community Support

Hi @Analitika ,

Sorry I'm not very clear about your expected result, would you like to explain more about it?

Best Regards,
Community Support Team _ kalyj

Yes, the essence of my goal is to create visual which contains sales columns as usual, previous photo, also adding that new lines will be separated (the lines number depends on selected years in the slicer ( number of lines equal to number of selected years and so on.) How to achieve this:

Current visual looks like this:

Analitika_1-1665487872015.png

Line measure is that:

 

Veiklos sąnaudų 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


DIVIDE([_6_1_0_VS Sanaudos veiklos],valandos)

 

 

Help me pls to get that result.

 

 

 

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

Find out what's new and trending in the Fabric Community.