diff --git a/powerbi-docs/transform-model/desktop-visual-calculations-overview.md b/powerbi-docs/transform-model/desktop-visual-calculations-overview.md index ed2fabe9a0..28d4397aa0 100644 --- a/powerbi-docs/transform-model/desktop-visual-calculations-overview.md +++ b/powerbi-docs/transform-model/desktop-visual-calculations-overview.md @@ -257,6 +257,47 @@ Visual calculations also introduce a set of functions specific to visual calcula You can format a visual calculation using data types and formatting options. You can also set a [custom visual level format string](../create-reports/desktop-custom-format-strings.md). Use the **Data format** options in the General section of the formatting pane for your visual to set the format: :::image type="content" source="media/desktop-visual-calculations-overview/desktop-visual-calculations-format-strings.png" alt-text="Screenshot of the visual calculations edit mode showing a visual calculation that returns a percentage formatted as a percentage."::: +## Example 1: Using Visual Calculation to return a Hex color code for conditional formatting + +Step 1: Select The visual you would like to use the conditional formatting in: + +:::image type="content" source="media/desktop-visual-calculations-overview/desktop-visual-calculations-hex-example-01.png" alt-text="Screenshot of a table visual with two columns Value and Progress"::: + +Step 2: Click the “New visual calculation” button under the “Home” Tab: + +:::image type="content" source="media/desktop-visual-calculations-overview/desktop-visual-calculations-hex-example-02.png" alt-text="Screenshot of the button to create a visual calc in the Power BI Home Tab"::: + +Step 3: Write your visual calc. Here is a if statement to return either green or red based on a measure being more then .5: + +:::image type="content" source="media/desktop-visual-calculations-overview/desktop-visual-calculations-hex-example-03.png" alt-text="Screenshot of DAX code listed out below in the visual calac editor"::: + +```dax +Conditional Hex Code = if([Progress]>.5,"#00FF00","FF0000") +``` + +Step 4: Expand the Formatting Pane and Click Properties: + +:::image type="content" source="media/desktop-visual-calculations-overview/desktop-visual-calculations-hex-example-04.png" alt-text="Screenshot of the formatting Pane showing that you should click properties"::: + +Step 5: Expand the “Data Format” section, select your Visual Calc, and set both the Data Type and format to “Text”: + +:::image type="content" source="media/desktop-visual-calculations-overview/desktop-visual-calculations-hex-example-05.png" alt-text="Screenshot of the formatting pane showing you should apply a data type to your visual calc of text"::: + +Step 6: Before Exiting the Visual Calc editor click the eyeball next to the visual calc in the build section to hide it: + +:::image type="content" source="media/desktop-visual-calculations-overview/desktop-visual-calculations-hex-example-06.png" alt-text="Screenshot of the build pane showing how to click a button to hide the visual calc you are creating"::: + +Step 7: Use it in a conditional formatting section: + +:::image type="content" source="media/desktop-visual-calculations-overview/desktop-visual-calculations-hex-example-07.png" alt-text="Screenshot of a conditional formatting window where the visual calc has been selected"::: + +Step 8: Exit the visual calc editor by clicking the “Back to report” button: + +:::image type="content" source="media/desktop-visual-calculations-overview/desktop-visual-calculations-hex-example-08.png" alt-text="Screenshot of the button you push to exit out of the visual calc editor. Text is: Back to report"::: + +Step 9: Enjoy your conditional formatted visual! + +:::image type="content" source="media/desktop-visual-calculations-overview/desktop-visual-calculations-hex-example-09.png" alt-text="Screenshot of the table from the first screenshot now with conditional formatting applied"::: ## Considerations and limitations diff --git a/powerbi-docs/transform-model/media/desktop-visual-calculations-overview/desktop-visual-calculations-hex-example-01.png b/powerbi-docs/transform-model/media/desktop-visual-calculations-overview/desktop-visual-calculations-hex-example-01.png new file mode 100644 index 0000000000..59ebe6b0dd Binary files /dev/null and b/powerbi-docs/transform-model/media/desktop-visual-calculations-overview/desktop-visual-calculations-hex-example-01.png differ diff --git a/powerbi-docs/transform-model/media/desktop-visual-calculations-overview/desktop-visual-calculations-hex-example-02.png b/powerbi-docs/transform-model/media/desktop-visual-calculations-overview/desktop-visual-calculations-hex-example-02.png new file mode 100644 index 0000000000..d1e7cd535b Binary files /dev/null and b/powerbi-docs/transform-model/media/desktop-visual-calculations-overview/desktop-visual-calculations-hex-example-02.png differ diff --git a/powerbi-docs/transform-model/media/desktop-visual-calculations-overview/desktop-visual-calculations-hex-example-03.png b/powerbi-docs/transform-model/media/desktop-visual-calculations-overview/desktop-visual-calculations-hex-example-03.png new file mode 100644 index 0000000000..e7a86afbf2 Binary files /dev/null and b/powerbi-docs/transform-model/media/desktop-visual-calculations-overview/desktop-visual-calculations-hex-example-03.png differ diff --git a/powerbi-docs/transform-model/media/desktop-visual-calculations-overview/desktop-visual-calculations-hex-example-04.png b/powerbi-docs/transform-model/media/desktop-visual-calculations-overview/desktop-visual-calculations-hex-example-04.png new file mode 100644 index 0000000000..7ad32cee59 Binary files /dev/null and b/powerbi-docs/transform-model/media/desktop-visual-calculations-overview/desktop-visual-calculations-hex-example-04.png differ diff --git a/powerbi-docs/transform-model/media/desktop-visual-calculations-overview/desktop-visual-calculations-hex-example-05.png b/powerbi-docs/transform-model/media/desktop-visual-calculations-overview/desktop-visual-calculations-hex-example-05.png new file mode 100644 index 0000000000..69f08fe38f Binary files /dev/null and b/powerbi-docs/transform-model/media/desktop-visual-calculations-overview/desktop-visual-calculations-hex-example-05.png differ diff --git a/powerbi-docs/transform-model/media/desktop-visual-calculations-overview/desktop-visual-calculations-hex-example-06.png b/powerbi-docs/transform-model/media/desktop-visual-calculations-overview/desktop-visual-calculations-hex-example-06.png new file mode 100644 index 0000000000..289f8fe29e Binary files /dev/null and b/powerbi-docs/transform-model/media/desktop-visual-calculations-overview/desktop-visual-calculations-hex-example-06.png differ diff --git a/powerbi-docs/transform-model/media/desktop-visual-calculations-overview/desktop-visual-calculations-hex-example-07.png b/powerbi-docs/transform-model/media/desktop-visual-calculations-overview/desktop-visual-calculations-hex-example-07.png new file mode 100644 index 0000000000..6b94d158e1 Binary files /dev/null and b/powerbi-docs/transform-model/media/desktop-visual-calculations-overview/desktop-visual-calculations-hex-example-07.png differ diff --git a/powerbi-docs/transform-model/media/desktop-visual-calculations-overview/desktop-visual-calculations-hex-example-08.png b/powerbi-docs/transform-model/media/desktop-visual-calculations-overview/desktop-visual-calculations-hex-example-08.png new file mode 100644 index 0000000000..dc32442053 Binary files /dev/null and b/powerbi-docs/transform-model/media/desktop-visual-calculations-overview/desktop-visual-calculations-hex-example-08.png differ diff --git a/powerbi-docs/transform-model/media/desktop-visual-calculations-overview/desktop-visual-calculations-hex-example-09.png b/powerbi-docs/transform-model/media/desktop-visual-calculations-overview/desktop-visual-calculations-hex-example-09.png new file mode 100644 index 0000000000..e48cd32cbc Binary files /dev/null and b/powerbi-docs/transform-model/media/desktop-visual-calculations-overview/desktop-visual-calculations-hex-example-09.png differ