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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
marcelocostafil
Frequent Visitor

Get higher column number and put in a straight line in graphic

Hello!

 

I have a column + line graphic and I need a new measure that gets the higher column and make a single value that goes by the entire graphic. I'm terrible at explaining this, so I'll try to put in images.

Instead of the higher value per month with line, I want my graphic to get like this a straight line following the higher column, no matter the year + week:

marcelocostafil_0-1713369951679.png

 

The values from the graphic comes from this formula:

IF(
    [Filtro TI e VS], -- This is a true/false filter  
    CALCULATE(
        SUM(BLs[TEUs]),
        BLs[Estado do Contentor] = "Cheio",
        USERELATIONSHIP(BLs[ID Porto Origem],'Porto de Origem'[Cód. Porto de Origem]),
        USERELATIONSHIP(BLs[ID Porto Destino],'Porto de Destino'[Cód. Porto de Destino]),
        NOT(Cliente[ID Cliente] IN {"M11974", "CV00003", "T32528", "T11974", "11974", "32528"}) 
    ),
    CALCULATE(
        SUM(BLs[TEUs]),
        BLs[Estado do Contentor] = "Cheio",
        USERELATIONSHIP(BLs[ID Porto Origem],'Porto de Origem'[Cód. Porto de Origem]),
        USERELATIONSHIP(BLs[ID Porto Destino],'Porto de Destino'[Cód. Porto de Destino])
    )
)
 
And the year + week comes from a Calendar table

Thanks for the help and patience. Any problems or doubts, I'll try to be clearer.

 

 

 

 

3 ACCEPTED SOLUTIONS
tamerj1
Super User
Super User

Hi @marcelocostafil 

make sure to refer to the same year + week column that is present in the chart visual. 
MaxFormula =
MAXX ( ALLSELECTED ( 'Calendar'[Year + Week] ), [Formula] )

View solution in original post

Anonymous
Not applicable

Hi @marcelocostafil ,

 

Thanks for the reply from tamerj1 .

 

Here is the sample data I created.

Date

Product ID

ProductA Sales

ProductB Sales

2024/01/01

AAA

100

250

2024/02/01

BBB

150

150

2024/03/01

CCC

250

200

2024/04/01

DDD

200

350

2024/05/01

EEE

450

200

2024/06/01

FFF

350

120

2024/07/01

GGG

400

280

 

Create an index column in Power Query to better sort the chart.

vhuijieymsft_0-1713409839029.png

 

Create a calculated column to calculate the week of year:

Year & Week = YEAR('Table'[Date]) & " " & WEEKNUM('Table'[Date])

 

Create a measure:

Max Sales =
MAXX(
     {
         (CALCULATE(MAX('Table'[ProductA Sales]), ALL('Table'))),
         (CALCULATE(MAX('Table'[ProductB Sales]), ALL('Table')))
     },
     [Value]
)

 

The final page effect is as follows:

vhuijieymsft_1-1713409839035.png

 

pbix file is attached.

 

If you have any further questions please feel free to contact me.

 

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

View solution in original post

Thank you so much!!

I was missing the "ALSELECTED" 😞

In the end, I've used both columns like this:

MAXX(ALLSELECTED('Calendário'[Semana],'Calendário'[Ano (Semana)]), [Measure])

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @marcelocostafil ,

 

Thanks for the reply from tamerj1 .

 

Here is the sample data I created.

Date

Product ID

ProductA Sales

ProductB Sales

2024/01/01

AAA

100

250

2024/02/01

BBB

150

150

2024/03/01

CCC

250

200

2024/04/01

DDD

200

350

2024/05/01

EEE

450

200

2024/06/01

FFF

350

120

2024/07/01

GGG

400

280

 

Create an index column in Power Query to better sort the chart.

vhuijieymsft_0-1713409839029.png

 

Create a calculated column to calculate the week of year:

Year & Week = YEAR('Table'[Date]) & " " & WEEKNUM('Table'[Date])

 

Create a measure:

Max Sales =
MAXX(
     {
         (CALCULATE(MAX('Table'[ProductA Sales]), ALL('Table'))),
         (CALCULATE(MAX('Table'[ProductB Sales]), ALL('Table')))
     },
     [Value]
)

 

The final page effect is as follows:

vhuijieymsft_1-1713409839035.png

 

pbix file is attached.

 

If you have any further questions please feel free to contact me.

 

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

tamerj1
Super User
Super User

Hi @marcelocostafil 

make sure to refer to the same year + week column that is present in the chart visual. 
MaxFormula =
MAXX ( ALLSELECTED ( 'Calendar'[Year + Week] ), [Formula] )

Thank you so much!!

I was missing the "ALSELECTED" 😞

In the end, I've used both columns like this:

MAXX(ALLSELECTED('Calendário'[Semana],'Calendário'[Ano (Semana)]), [Measure])

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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