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
Anonymous
Not applicable

Column Chart - various questions

 

Hi I'm trying to create a visual (Stacked Column chart) to show the data for all the periods up to now and the current period (separate visual)

Data is as follows:

 

Block | Date | Occupancy

A | 13/09/2019 | 34

A | 20/09/2019 | 36

A | 27/09/2019 | 38

B | 04/10/2019 | 40

B | 11/10/2019 | 44

B | 18/10/2019 | 45

C | 25/10/2019 | (not yet populated)

C | 02/11/2019 | (not yet populated)

A bigger representation of teh sample data is here:

https://pasteboard.co/IAJiUk3.png

 

The data points are working Friday dates so it's quite irregular as some Fridays fall on holidays, etc. Periods (Blocks) start in September (Block A) and end in July Block F. Please note that although we are in Block A, I've added more sample data up till Block C to help create the visual.

 

I'm trying to create a  chart visual spanning from Block A to current period.  See the top visual on the image below:

All Blocks

https://pasteboard.co/IAJfHoq.png

 

- Although I've changed the setting from 'Date Hierarchy' to "General Date" column in the visual Axis setting, it does not display individual dates (but months: Oct 2019, Nov 2019) on the X axis.

- There's a blank gap at the end of December/ Beginning of January (as the data points do not exist for that period). Can it be more evenly spread - this probably is going to be solved with my previous point

 

Also, I'd like to display the more detailed breakdown for the current Block (bottom visual)

Current Block

https://pasteboard.co/IAJg5ru.png

- again the X Axis data points (dates) seem to be misalign with the columns (And do not show the actual data point (dates specified in the dataset)

- How would I automatically dispaly the latest block? I assume it could be done by checking the last non-empty row in the eg. Occupancy column and getting the block from that. Although all the Friday dates are prepopulated, staff inputs the relevant data each week.

 

Please advise and thank you very much.

1 ACCEPTED SOLUTION
v-joesh-msft
Solution Sage
Solution Sage

Hi @Anonymous ,

You can try the following methods:

1. It does not display individual dates on the X-axis and has blank gaps:

In the Format, change the X-axis type to Categorical, the solution in the Current Block is the same:

1.PNG2. How to automatically display the latest block:

You can create a measure as follows:

Measure =
VAR _lastdateblock =
    CALCULATE (
        MAX ( 'Table'[Block] ),
        FILTER (
            ALLSELECTED ( 'Table'[Date] ),
            'Table'[Date]
                = CALCULATE (
                    MAX ( 'Table'[Date] ),
                    FILTER ( ALL ( 'Table' ), 'Table'[Occupancy] <> BLANK () )
                )
        )
    )
RETURN
    CALCULATE (
        SUM ( 'Table'[Occupancy] ),
        FILTER ( 'Table', 'Table'[Block] = _lastdateblock )
    )

When you create a visual, the results are as follows:

2.PNG

Here is a demo, please try it:

https://qiuyunus-my.sharepoint.com/:u:/g/personal/pbipro_qiuyunus_onmicrosoft_com/Ee9YPKNrTaNIinDgPL9epukBIxgUaEuvAIFD1qxX2ZqMhQ?e=CfxnAv

 

Best Regards,

Community Support Team _ Joey
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

2 REPLIES 2
v-joesh-msft
Solution Sage
Solution Sage

Hi @Anonymous ,

You can try the following methods:

1. It does not display individual dates on the X-axis and has blank gaps:

In the Format, change the X-axis type to Categorical, the solution in the Current Block is the same:

1.PNG2. How to automatically display the latest block:

You can create a measure as follows:

Measure =
VAR _lastdateblock =
    CALCULATE (
        MAX ( 'Table'[Block] ),
        FILTER (
            ALLSELECTED ( 'Table'[Date] ),
            'Table'[Date]
                = CALCULATE (
                    MAX ( 'Table'[Date] ),
                    FILTER ( ALL ( 'Table' ), 'Table'[Occupancy] <> BLANK () )
                )
        )
    )
RETURN
    CALCULATE (
        SUM ( 'Table'[Occupancy] ),
        FILTER ( 'Table', 'Table'[Block] = _lastdateblock )
    )

When you create a visual, the results are as follows:

2.PNG

Here is a demo, please try it:

https://qiuyunus-my.sharepoint.com/:u:/g/personal/pbipro_qiuyunus_onmicrosoft_com/Ee9YPKNrTaNIinDgPL9epukBIxgUaEuvAIFD1qxX2ZqMhQ?e=CfxnAv

 

Best Regards,

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

Anonymous
Not applicable

Thank you very much for the explanation and demo. That's it. The demo looks great.

I'm now trying to get more confident with DAX.

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.