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
kylee_anne
Helper II
Helper II

Condition formatting or advanced DAX of s-curve lines

Hi,

I have this visual.

kylee_anne_0-1751596487037.png

And the DAX for my yellow line is:

P6 Remaining Units Curve running total in Date (month bins) =
CALCULATE(
    CALCULATE(sum('Resource M'[Value]),'Resource M'[Spreadsheet Field]="Actual Units"),
    FILTER(
        ALLSELECTED('Date'[Date (month bins)]),
        ISONORAFTER('Date'[Date (month bins)], MAX('Date'[Date (month bins)]), DESC)
    )
)
+
CALCULATE(
    [P6 Remaining Units Curve],
    FILTER(
        ALLSELECTED('Date'[Date (month bins)]),
        ISONORAFTER('Date'[Date (month bins)], MAX('Date'[Date (month bins)]), DESC)
    )
)
Sorry a bit clumsy but it works.
What I want is to make first half of the line, less than a certain date or the actual from the DAX, transparent and the other half to remain yellow.  But I can't think of the best way to do this.  All help appreciated.
1 ACCEPTED SOLUTION
Sandip_Palit
Regular Visitor

Power BI does not support direct transparency for line segments, so this workaround uses conditional logic to split the visual representation based on a defined date.

Step 1: Create a parameter or identify the split date
Decide the date that will act as the divider for the line. This can be a static date or dynamically calculated based on your actuals. For example, you can use a fixed date such as 30 June 2025, or the latest actuals date.

- Example: SplitDate = DATE(2025,6,30)

Step 2: Create a DAX measure for the first half of the line
This measure returns the calculated value only before or up to the split date. Values beyond that will return BLANK.

P6 Remaining Units Curve Before Split =
VAR SplitDate = DATE(2025,6,30)
RETURN
IF(
    MAX('Date'[Date (month bins)]) <= SplitDate,
    CALCULATE(
        CALCULATE(sum('Resource M'[Value]),'Resource M'[Spreadsheet Field]="Actual Units"),
        FILTER(
            ALLSELECTED('Date'[Date (month bins)]),
            ISONORAFTER('Date'[Date (month bins)], MAX('Date'[Date (month bins)]), DESC)
        )
    )
    +
    CALCULATE(
        [P6 Remaining Units Curve],
        FILTER(
            ALLSELECTED('Date'[Date (month bins)]),
            ISONORAFTER('Date'[Date (month bins)], MAX('Date'[Date (month bins)]), DESC)
        )
    ),
    BLANK()
)

Step 3: Create a second DAX measure for the second half of the line
This measure returns values only for dates after the split date.

P6 Remaining Units Curve After Split =
VAR SplitDate = DATE(2025,6,30)
RETURN
IF(
    MAX('Date'[Date (month bins)]) > SplitDate,
    CALCULATE(
        CALCULATE(sum('Resource M'[Value]),'Resource M'[Spreadsheet Field]="Actual Units"),
        FILTER(
            ALLSELECTED('Date'[Date (month bins)]),
            ISONORAFTER('Date'[Date (month bins)], MAX('Date'[Date (month bins)]), DESC)
        )
    )
    +
    CALCULATE(
        [P6 Remaining Units Curve],
        FILTER(
            ALLSELECTED('Date'[Date (month bins)]),
            ISONORAFTER('Date'[Date (month bins)], MAX('Date'[Date (month bins)]), DESC)
        )
    ),
    BLANK()
)

Step 4: Add both measures to your line chart
Use these two new measures as separate series in your visual:

- Format the 'Before Split' line to be transparent or very faint.
- Format the 'After Split' line to remain yellow as desired.


Step 5: Adjust tooltip and legend

Rename or hide the legend for the first line to avoid confusion. Suppress tooltips for the transparent line if necessary using a separate tooltip page or measure-based filtering.


Step 6: Optional – dynamic split date

To dynamically calculate the split date based on data (e.g., latest actuals date), replace the static date with a dynamic variable:

- VAR SplitDate = CALCULATE(MAX('ActualsTable'[Date]), ALL('ActualsTable'))


If this solves your issue, please like and accept the solution.

View solution in original post

3 REPLIES 3
Sandip_Palit
Regular Visitor

Power BI does not support direct transparency for line segments, so this workaround uses conditional logic to split the visual representation based on a defined date.

Step 1: Create a parameter or identify the split date
Decide the date that will act as the divider for the line. This can be a static date or dynamically calculated based on your actuals. For example, you can use a fixed date such as 30 June 2025, or the latest actuals date.

- Example: SplitDate = DATE(2025,6,30)

Step 2: Create a DAX measure for the first half of the line
This measure returns the calculated value only before or up to the split date. Values beyond that will return BLANK.

P6 Remaining Units Curve Before Split =
VAR SplitDate = DATE(2025,6,30)
RETURN
IF(
    MAX('Date'[Date (month bins)]) <= SplitDate,
    CALCULATE(
        CALCULATE(sum('Resource M'[Value]),'Resource M'[Spreadsheet Field]="Actual Units"),
        FILTER(
            ALLSELECTED('Date'[Date (month bins)]),
            ISONORAFTER('Date'[Date (month bins)], MAX('Date'[Date (month bins)]), DESC)
        )
    )
    +
    CALCULATE(
        [P6 Remaining Units Curve],
        FILTER(
            ALLSELECTED('Date'[Date (month bins)]),
            ISONORAFTER('Date'[Date (month bins)], MAX('Date'[Date (month bins)]), DESC)
        )
    ),
    BLANK()
)

Step 3: Create a second DAX measure for the second half of the line
This measure returns values only for dates after the split date.

P6 Remaining Units Curve After Split =
VAR SplitDate = DATE(2025,6,30)
RETURN
IF(
    MAX('Date'[Date (month bins)]) > SplitDate,
    CALCULATE(
        CALCULATE(sum('Resource M'[Value]),'Resource M'[Spreadsheet Field]="Actual Units"),
        FILTER(
            ALLSELECTED('Date'[Date (month bins)]),
            ISONORAFTER('Date'[Date (month bins)], MAX('Date'[Date (month bins)]), DESC)
        )
    )
    +
    CALCULATE(
        [P6 Remaining Units Curve],
        FILTER(
            ALLSELECTED('Date'[Date (month bins)]),
            ISONORAFTER('Date'[Date (month bins)], MAX('Date'[Date (month bins)]), DESC)
        )
    ),
    BLANK()
)

Step 4: Add both measures to your line chart
Use these two new measures as separate series in your visual:

- Format the 'Before Split' line to be transparent or very faint.
- Format the 'After Split' line to remain yellow as desired.


Step 5: Adjust tooltip and legend

Rename or hide the legend for the first line to avoid confusion. Suppress tooltips for the transparent line if necessary using a separate tooltip page or measure-based filtering.


Step 6: Optional – dynamic split date

To dynamically calculate the split date based on data (e.g., latest actuals date), replace the static date with a dynamic variable:

- VAR SplitDate = CALCULATE(MAX('ActualsTable'[Date]), ALL('ActualsTable'))


If this solves your issue, please like and accept the solution.

Thanks heaps!  I'll tinker with dates but this is great!

v-dineshya
Community Support
Community Support

HI @kylee_anne ,

Thank you for reaching out to the Microsoft Community Forum.

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Please show the expected outcome based on the sample data you provided.


Regards,
Dinesh

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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 community update carousel

Fabric Community Update - June 2025

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