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
DebbieE
Community Champion
Community Champion

Adding two different measures and axis Descriptors into one visual (Column chart)

We have the following visual that someone wants to add into Power BI

MixedChart.png

we have a problem here because

X Axis uses Quarter

Then uses Financial Year for the second half of the visual

 

Y Axis (The measure)

Uses Sum(Total Facts) 

And then for the next section uses Average(Future Facts)

 

Its basically two visuals merged into one.

Just on the offchance. Does anyone have an idea how this could be accomplished in Power BI? 

2 REPLIES 2
v-jingzhang
Community Support
Community Support

Hi @DebbieE 

 

You may add a disconnected table to have all X-axis values similar to below, 

vjingzhang_0-1683865731123.png

Then create a measure similar to 

result =
SWITCH (
    TRUE (),
    SELECTEDVALUE ( 'Table'[Year] ) = "21-22",
        CALCULATE (
            SUM ( 'FactTable'[value] ),
            'FactTable'[Year] = SELECTEDVALUE ( 'Table'[Year] ),
            'FactTable'[Quarter] = SELECTEDVALUE ( 'Table'[Quarter] )
        ),
    SELECTEDVALUE ( 'Table'[Year] ) = "22-23",
        SWITCH (
            TRUE (),
            SELECTEDVALUE ( 'Table'[Quarter] ) IN { "Q1", "Q2" },
                CALCULATE (
                    SUM ( 'FactTable'[value] ),
                    'FactTable'[Year] = SELECTEDVALUE ( 'Table'[Year] ),
                    'FactTable'[Quarter] = SELECTEDVALUE ( 'Table'[Quarter] )
                ),
            CALCULATE (
                AVERAGE ( 'FactTable'[value] ),
                'FactTable'[Year] = SELECTEDVALUE ( 'Table'[Year] )
            )
        ),
    CALCULATE (
        AVERAGE ( 'FactTable'[value] ),
        'FactTable'[Year] = SELECTEDVALUE ( 'Table'[Year] )
    )
)

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

Its looking ok but I dont want to have to hard code the years into the measure. Is there any way that I could change this so I dont have to hard code the years in because obviously this does change and the further we go the more years will have to be hard coded

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.