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

The FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now

Reply
Anonymous
Not applicable

How to display multiple custom date conditions in a single visual

Hello,

 

I have the following example data:

 

DateSaleCost
1/1/2020537
1/15/20207821
2/1/20203112
2/15/2020845
3/1/20205320
3/15/20203118
4/1/2020557
4/15/2020966
5/1/2020698
5/15/20203315
6/1/20205417
6/15/20204618
7/1/20206518
7/15/20208422
8/1/20203513
8/15/20205210
9/1/2020979
9/15/20208813
10/1/20204621
10/15/2020729
11/1/20209716
11/15/20205119
12/1/2020357
12/15/2020715
1/1/2021906
1/15/20217520
2/1/20214622
2/15/20218921
3/1/20216721
3/15/2021889
4/1/20219220
4/15/2021957
5/1/2021886
5/15/20218818
6/1/2021316
6/15/20214819

 

I want to display 3 specific custom date filters on a scatter plot. For example I want to to display the following date filters:

 

1/1/2020 - 12/31/2020
4/1/2020 - 3/31/2021
7/1/2020 - 6/30/2021

I understand that there will be overlaps in the data, but I want 3 different data markers to be displayed on the scatterplot. Right now I can only achieve individual quarters to be displayed, instead of the year long distinction that I need.



I want the visual to breakdown the lines as so:

 

1st line: 

1/1/2020537
1/15/20207821
2/1/20203112
2/15/2020845
3/1/20205320
3/15/20203118
4/1/2020557
4/15/2020966
5/1/2020698
5/15/20203315
6/1/20205417
6/15/20204618
7/1/20206518
7/15/20208422
8/1/20203513
8/15/20205210
9/1/2020979
9/15/20208813
10/1/20204621
10/15/2020729
11/1/20209716
11/15/20205119
12/1/2020357
12/15/2020715

 

2nd line:

4/1/2020557
4/15/2020966
5/1/2020698
5/15/20203315
6/1/20205417
6/15/20204618
7/1/20206518
7/15/20208422
8/1/20203513
8/15/20205210
9/1/2020979
9/15/20208813
10/1/20204621
10/15/2020729
11/1/20209716
11/15/20205119
12/1/2020357
12/15/2020715
1/1/2021906
1/15/20217520
2/1/20214622
2/15/20218921
3/1/20216721
3/15/2021889

 

3rd line:

7/1/20206518
7/15/20208422
8/1/20203513
8/15/20205210
9/1/2020979
9/15/20208813
10/1/20204621
10/15/2020729
11/1/20209716
11/15/20205119
12/1/2020357
12/15/2020715
1/1/2021906
1/15/20217520
2/1/20214622
2/15/20218921
3/1/20216721
3/15/2021889
4/1/20219220
4/15/2021957
5/1/2021886
5/15/20218818
6/1/2021316
6/15/20214819

 

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

Hi @Anonymous ,

 

Please try:

First create a new table:

NewTable = 
VAR _a = { "1/1/2020 - 12/31/2020", "4/1/2020 - 3/31/2021", "7/1/2020 - 6/30/2021" }
VAR _b =
    CROSSJOIN ( _a, VALUES ( 'Table'[Date] ) )
VAR _c =
    FILTER (
        _b,
        [Date]
            >= DATE ( RIGHT ( LEFT ( [Value], FIND ( "-", [Value] ) - 2 ), 4 ), LEFT (
                LEFT ( [Value], FIND ( "-", [Value] ) - 2 ),
                FIND ( "/", LEFT ( [Value], FIND ( "-", [Value] ) - 2 ) ) - 1
            ), MID (
                LEFT ( [Value], FIND ( "-", [Value] ) - 2 ),
                FIND ( "/", [Value], FIND ( "/", [Value], 1 ) ) + 1,
                FIND ( "/", [Value], 1 + FIND ( "/", [Value], 1 ) )
                    - FIND ( "/", [Value], 1 ) - 1
            ) )
            && [Date]
                <= DATE ( RIGHT ( RIGHT ( [Value], LEN ( [Value] ) - FIND ( "-", [Value] ) - 1 ), 4 ), LEFT (
                    RIGHT ( [Value], LEN ( [Value] ) - FIND ( "-", [Value] ) - 1 ),
                    FIND ( "/", RIGHT ( [Value], LEN ( [Value] ) - FIND ( "-", [Value] ) - 1 ) ) - 1
                ), MID (
                    RIGHT ( [Value], LEN ( [Value] ) - FIND ( "-", [Value] ) - 1 ),
                    FIND (
                        "/",
                        RIGHT ( [Value], LEN ( [Value] ) - FIND ( "-", [Value] ) - 1 ),
                        FIND ( "/", [Value], 1 )
                    ) + 1,
                    FIND (
                        "/",
                        RIGHT ( [Value], LEN ( [Value] ) - FIND ( "-", [Value] ) - 1 ),
                        1
                            + FIND ( "/", RIGHT ( [Value], LEN ( [Value] ) - FIND ( "-", [Value] ) - 1 ), 1 )
                    )
                        - FIND ( "/", RIGHT ( [Value], LEN ( [Value] ) - FIND ( "-", [Value] ) - 1 ), 1 ) - 1
                ) )
    )
RETURN
    _c

Output:

vjianbolimsft_0-1687412555659.png

Then apply these two measrues to a matrix visual:

Sale = SUMX(FILTER('Table',[Date] in SELECTCOLUMNS('NewTable',"Date",[Date])),[Sale])

Cost = SUMX(FILTER('Table',[Date] in SELECTCOLUMNS('NewTable',"Date",[Date])),[Cost])

vjianbolimsft_1-1687412619911.png

Final output:

vjianbolimsft_2-1687412635662.png

Best Regards,

Jianbo Li

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

1 REPLY 1
v-jianboli-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please try:

First create a new table:

NewTable = 
VAR _a = { "1/1/2020 - 12/31/2020", "4/1/2020 - 3/31/2021", "7/1/2020 - 6/30/2021" }
VAR _b =
    CROSSJOIN ( _a, VALUES ( 'Table'[Date] ) )
VAR _c =
    FILTER (
        _b,
        [Date]
            >= DATE ( RIGHT ( LEFT ( [Value], FIND ( "-", [Value] ) - 2 ), 4 ), LEFT (
                LEFT ( [Value], FIND ( "-", [Value] ) - 2 ),
                FIND ( "/", LEFT ( [Value], FIND ( "-", [Value] ) - 2 ) ) - 1
            ), MID (
                LEFT ( [Value], FIND ( "-", [Value] ) - 2 ),
                FIND ( "/", [Value], FIND ( "/", [Value], 1 ) ) + 1,
                FIND ( "/", [Value], 1 + FIND ( "/", [Value], 1 ) )
                    - FIND ( "/", [Value], 1 ) - 1
            ) )
            && [Date]
                <= DATE ( RIGHT ( RIGHT ( [Value], LEN ( [Value] ) - FIND ( "-", [Value] ) - 1 ), 4 ), LEFT (
                    RIGHT ( [Value], LEN ( [Value] ) - FIND ( "-", [Value] ) - 1 ),
                    FIND ( "/", RIGHT ( [Value], LEN ( [Value] ) - FIND ( "-", [Value] ) - 1 ) ) - 1
                ), MID (
                    RIGHT ( [Value], LEN ( [Value] ) - FIND ( "-", [Value] ) - 1 ),
                    FIND (
                        "/",
                        RIGHT ( [Value], LEN ( [Value] ) - FIND ( "-", [Value] ) - 1 ),
                        FIND ( "/", [Value], 1 )
                    ) + 1,
                    FIND (
                        "/",
                        RIGHT ( [Value], LEN ( [Value] ) - FIND ( "-", [Value] ) - 1 ),
                        1
                            + FIND ( "/", RIGHT ( [Value], LEN ( [Value] ) - FIND ( "-", [Value] ) - 1 ), 1 )
                    )
                        - FIND ( "/", RIGHT ( [Value], LEN ( [Value] ) - FIND ( "-", [Value] ) - 1 ), 1 ) - 1
                ) )
    )
RETURN
    _c

Output:

vjianbolimsft_0-1687412555659.png

Then apply these two measrues to a matrix visual:

Sale = SUMX(FILTER('Table',[Date] in SELECTCOLUMNS('NewTable',"Date",[Date])),[Sale])

Cost = SUMX(FILTER('Table',[Date] in SELECTCOLUMNS('NewTable',"Date",[Date])),[Cost])

vjianbolimsft_1-1687412619911.png

Final output:

vjianbolimsft_2-1687412635662.png

Best Regards,

Jianbo Li

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

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.