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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
SirJJAnderson
Helper III
Helper III

How to create a visual like this?

How would I go about creating a visual like this excel?

 

Screen Shot 2020-05-11 at 7.44.39 AM.png

 

I tried creating the below visual with dates for columns and my metrics for rows, but the metric data doesn't get put under the column. Ideally, the metric label should be the row, and the metric data should live in the columns.

 

Screen Shot 2020-05-11 at 7.28.27 AM.png

1 ACCEPTED SOLUTION
v-zhenbw-msft
Community Support
Community Support

Hi @SirJJAnderson ,

 

We can use the following steps to meet your requirement.

 

1. We need to create a new table that contains results table framework.

 

DimTable = 
CROSSJOIN (
    DATATABLE (
        "RowName", STRING,
        "RowSort", INTEGER,
        {
            { "Deliveries", 1 },
            { "Open Rate", 2 },
            { "Opens", 3 },
            { "Visit Rate", 4 },
            { "Visits", 5 }
        }
    ),
    DATATABLE (
        "ColumnName", STRING,
        "ColumnSort", INTEGER,
        {
            { "Last 30 Days", 1 },
            { "30 Days Prior", 2 },
            { "% Change", 3 }
        }
    )
)

 

How 1.jpg

 

2. Then we can unpivot the RowName in Power Query Editor.

 

How 2.jpg

 

How 3.jpg

 

3. And we can create a measure in Dim table to calculate the value and format it.

 

Measure = 
FORMAT (
    SWITCH (
        SELECTEDVALUE ( 'DimTable'[ColumnName], BLANK () ),
        "Last 30 Days", CALCULATE (
            SUM ( 'Table'[Value] ),
            FILTER (
                'Table',
                'Table'[Row] IN DISTINCT ( 'DimTable'[RowName] )
                    && 'Table'[Send Date]
                        >= TODAY () - 30
                    && 'Table'[Send Date] <= TODAY ()
            )
        ),
        "30 Days Prior", CALCULATE (
            SUM ( 'Table'[Value] ),
            FILTER (
                'Table',
                'Table'[Row] IN DISTINCT ( 'DimTable'[RowName] )
                    && 'Table'[Send Date]
                        < TODAY () - 30
            )
        ),
        "% Change", ABS (
            DIVIDE (
                CALCULATE (
                    SUM ( 'Table'[Value] ),
                    FILTER (
                        'Table',
                        'Table'[Row] IN DISTINCT ( 'DimTable'[RowName] )
                            && 'Table'[Send Date]
                                >= TODAY () - 30
                            && 'Table'[Send Date] <= TODAY ()
                    )
                ),
                CALCULATE (
                    SUM ( 'Table'[Value] ),
                    FILTER (
                        'Table',
                        'Table'[Row] IN DISTINCT ( 'DimTable'[RowName] )
                            && 'Table'[Send Date]
                                < TODAY () - 30
                    )
                ),
                0
            ) - 1
        )
    ),
    SWITCH (
        TRUE (),
        CONTAINSSTRING ( SELECTEDVALUE ( DimTable[RowName], BLANK () ), "Rate" )
            || CONTAINSSTRING ( SELECTEDVALUE ( DimTable[ColumnName], BLANK () ), "%" ), "Percent",
        "General Number"
    )
)

 

How 4.jpg

 

4. At last, we need to create a color measure to configure the % change’s color.

 

Color = 
IF (
    SELECTEDVALUE ( DimTable[ColumnName], BLANK () ) = "% Change",
    IF (
        DIVIDE (
            CALCULATE (
                SUM ( 'Table'[Value] ),
                FILTER (
                    'Table',
                    'Table'[Row] IN DISTINCT ( 'DimTable'[RowName] )
                        && 'Table'[Send Date]
                            >= TODAY () - 30
                        && 'Table'[Send Date] <= TODAY ()
                )
            ),
            CALCULATE (
                SUM ( 'Table'[Value] ),
                FILTER (
                    'Table',
                    'Table'[Row] IN DISTINCT ( 'DimTable'[RowName] )
                        && 'Table'[Send Date]
                            < TODAY () - 30
                )
            ),
            0
        ) - 1 >= 0,
        "#FF0000",
        "#00FF00"
    ),
    BLANK ()
)

 

How 5.jpg

 

And the result like this,

 

How 6.jpg

 

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?

BTW, pbix as attached.       

 

Best regards,

 

Community Support Team _ zhenbw

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

8 REPLIES 8
v-zhenbw-msft
Community Support
Community Support

Hi @SirJJAnderson ,

 

We can use the following steps to meet your requirement.

 

1. We need to create a new table that contains results table framework.

 

DimTable = 
CROSSJOIN (
    DATATABLE (
        "RowName", STRING,
        "RowSort", INTEGER,
        {
            { "Deliveries", 1 },
            { "Open Rate", 2 },
            { "Opens", 3 },
            { "Visit Rate", 4 },
            { "Visits", 5 }
        }
    ),
    DATATABLE (
        "ColumnName", STRING,
        "ColumnSort", INTEGER,
        {
            { "Last 30 Days", 1 },
            { "30 Days Prior", 2 },
            { "% Change", 3 }
        }
    )
)

 

How 1.jpg

 

2. Then we can unpivot the RowName in Power Query Editor.

 

How 2.jpg

 

How 3.jpg

 

3. And we can create a measure in Dim table to calculate the value and format it.

 

Measure = 
FORMAT (
    SWITCH (
        SELECTEDVALUE ( 'DimTable'[ColumnName], BLANK () ),
        "Last 30 Days", CALCULATE (
            SUM ( 'Table'[Value] ),
            FILTER (
                'Table',
                'Table'[Row] IN DISTINCT ( 'DimTable'[RowName] )
                    && 'Table'[Send Date]
                        >= TODAY () - 30
                    && 'Table'[Send Date] <= TODAY ()
            )
        ),
        "30 Days Prior", CALCULATE (
            SUM ( 'Table'[Value] ),
            FILTER (
                'Table',
                'Table'[Row] IN DISTINCT ( 'DimTable'[RowName] )
                    && 'Table'[Send Date]
                        < TODAY () - 30
            )
        ),
        "% Change", ABS (
            DIVIDE (
                CALCULATE (
                    SUM ( 'Table'[Value] ),
                    FILTER (
                        'Table',
                        'Table'[Row] IN DISTINCT ( 'DimTable'[RowName] )
                            && 'Table'[Send Date]
                                >= TODAY () - 30
                            && 'Table'[Send Date] <= TODAY ()
                    )
                ),
                CALCULATE (
                    SUM ( 'Table'[Value] ),
                    FILTER (
                        'Table',
                        'Table'[Row] IN DISTINCT ( 'DimTable'[RowName] )
                            && 'Table'[Send Date]
                                < TODAY () - 30
                    )
                ),
                0
            ) - 1
        )
    ),
    SWITCH (
        TRUE (),
        CONTAINSSTRING ( SELECTEDVALUE ( DimTable[RowName], BLANK () ), "Rate" )
            || CONTAINSSTRING ( SELECTEDVALUE ( DimTable[ColumnName], BLANK () ), "%" ), "Percent",
        "General Number"
    )
)

 

How 4.jpg

 

4. At last, we need to create a color measure to configure the % change’s color.

 

Color = 
IF (
    SELECTEDVALUE ( DimTable[ColumnName], BLANK () ) = "% Change",
    IF (
        DIVIDE (
            CALCULATE (
                SUM ( 'Table'[Value] ),
                FILTER (
                    'Table',
                    'Table'[Row] IN DISTINCT ( 'DimTable'[RowName] )
                        && 'Table'[Send Date]
                            >= TODAY () - 30
                        && 'Table'[Send Date] <= TODAY ()
                )
            ),
            CALCULATE (
                SUM ( 'Table'[Value] ),
                FILTER (
                    'Table',
                    'Table'[Row] IN DISTINCT ( 'DimTable'[RowName] )
                        && 'Table'[Send Date]
                            < TODAY () - 30
                )
            ),
            0
        ) - 1 >= 0,
        "#FF0000",
        "#00FF00"
    ),
    BLANK ()
)

 

How 5.jpg

 

And the result like this,

 

How 6.jpg

 

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?

BTW, pbix as attached.       

 

Best regards,

 

Community Support Team _ zhenbw

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

nandukrishnavs
Community Champion
Community Champion

@SirJJAnderson 

 

You can use Table/Matrix. You have to create 3 measures Last 30 Days, 30 Days Prior, and % Changes. Then apply conditional formatting for % Changes measure. 



Did I answer your question? Mark my post as a solution!
Appreciate with a kudos
🙂


Regards,
Nandu Krishna

I hate to ask this, but I'm a Power BI noob... how would I go about creating those measures? Is there a formula I can follow for each? Do I need to adjust or create a new date table?

@SirJJAnderson  Please share sample table (not image) and expected output.


Regards,
Nandu Krishna

@nandukrishnavs not sure if the below works? Expected output would be a sum of deliveries, opens and visits for Last 30 Days and the 30 Days Prior, and the percentage change.

 

Send DatePlatformBusiness Segment TypeCategoryEmail NameSubjectDeliveriesOpen RateOpensVisit RateVisits
3/10/20HubSpotAgent/AdvisorProspectingA53How are you adapting to new best interest regulations?18,48411.70%2,1633.19%69
3/10/20HubSpotGA/BGAProspectingG4Considered Automating Your Policy Review Process?39916.29%650.00%0
3/17/20HubSpotAgent/AdvisorProspectingA54Navigating the nuances of best interest standards19,03210.55%2,0071.84%37
3/17/20HubSpotGA/BGAProspectingG5Data-Driven Decision Making69519.14%1331.50%2
3/19/20HubSpotMultipleNewsletterNewsletter - MarchA Message from our Founder – Mike Pepe19,91014.69%2,9252.05%60
3/24/20HubSpotGA/BGAProspectingG6How are you safeguarding clients’ best interests?79118.96%1501.33%2
3/24/20HubSpotAgent/AdvisorProspectingA55How do you ensure your client recommendations are suitable?19,85812.82%2,5461.92%49
3/29/20HubSpotMultipleWebinarWE1 - Clarity in Uncertain TimesYou're Invited!19,84323.83%4,7281.52%72
4/1/20HubSpotMultipleWebinarWE2 - Clarity in Uncertain TimesReminder - Have you registered for “Helping Provide Clarity in Uncertain Times”?16,08516.08%2,5861.31%34
4/2/20HubSpotMultipleWebinarWE3 - Clarity in Uncertain Times1 Hour till Our Webinar Begins - Register Now!15,97013.20%2,1082.66%56
4/7/20HubSpotMultipleWebinarWE1 - Simplifying ComplexitiesHow are your clients’ policies being affected by COVID-19?16,09913.21%2,1261.51%32
4/14/20HubSpotMultipleWebinarWE2 - Simplifying ComplexitiesYour clients need you15,80513.62%2,1521.16%25
4/16/20HubSpotMultipleNewsletterNewsletter - AprilA Letter from Our CEO – Kris Beck14,38917.92%2,5792.17%56
4/20/20HubSpotMultipleWebinarWE3 - Simplifying ComplexitiesHow much longer can your clients’ policies tolerate this economic turbulence?15,51512.18%1,8900.85%16
4/23/20HubSpotMultipleWebinarWE1 - Protect Your TimeWhat does it mean to ‘manage by exception’?21,75611.68%2,5411.22%31
4/29/20HubSpotMultipleWebinarWE2 - Protect Your TimeHow can you protect your time during the COVID-19 crisis?21,43210.05%2,1541.21%26
5/4/20HubSpotMultipleWebinarWE3 - Protect Your Time[Live Webinar] Protect Your Time - Manage by Exception21,5729.19%1,9821.36%27
5/7/20HubSpotMultipleWhite PaperWP - COVID-19COVID-19 and the Life Insurance Industry21,13810.80%2,28212.31%281

I could also share pbix file if that would be better? You'll just have to tell me how to share it lol

@SirJJAnderson share the pbix file via google drive/dropbox


Regards,
Nandu Krishna

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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