Insights!

PLEASE VISIT TABLEAU VIDEOS OR POWER BI PAGES FOR MORE DETAILED VIDEOS

TOP TRENDING VIDEOS ON POWER BI, TABLEAU, MSTR AND PYTHON

Here’s a simple example to demonstrate how to create a Gantt chart in Power BI using DAX:

Suppose you have a table named “Tasks” with the following columns:

TaskName: Name of the task
StartDate: Start date of the task
EndDate: End date of the task
Import Data: Import your data into Power BI.

Calculate Duration: Create a DAX measure to calculate the duration of each task. You can do this by subtracting the start date from the end date.
TaskDuration = DATEDIFF(Tasks[StartDate], Tasks[EndDate], DAY) + 1

Create Task ID: Create a new column in your table to assign a unique ID to each task. This is necessary for creating the Gantt chart.
TaskID = RANKX(ALL(Tasks), Tasks[StartDate], , ASC, Dense)

Create Gantt Chart: Now, you can create a Gantt chart visual in Power BI using the TaskName, TaskID, StartDate, and TaskDuration fields.

Customize Gantt Chart: In the Gantt chart visualization settings, you can customize the appearance of the chart as needed, such as adjusting the colors, labels, and axes.

Format Dates: Make sure to format the StartDate and EndDate fields properly to display them in the desired date format.

This is a basic example to get you started with creating a Gantt chart in Power BI using DAX. Depending on your specific requirements and data model, you may need to adjust the DAX calculations and visualization settings accordingly.

Creating a multi-level Sankey chart in Power BI involves several steps, including data modeling, DAX calculations, and visualization setup. Below is an example of how you can create a multi-level Sankey chart in Power BI using DAX:

Step 1: Data Preparation

Ensure your data is structured appropriately for the multi-level Sankey chart. Typically, Sankey charts visualize flow between multiple categories or levels. For this example, let’s assume you have a table named “FlowData” with columns like “Source”, “Target”, and “Value”. Each row represents a flow from a source category to a target category, along with the value of the flow.

Step 2: Data Modeling

Create relationships between tables if necessary. In the case of a multi-level Sankey chart, you might have multiple tables representing different levels or categories. Ensure there are relationships between these tables.

Step 3: DAX Calculations

You might need to create DAX measures to aggregate and calculate values for the Sankey chart. For example, if you want to calculate the total flow from a source category to a target category, you can create a DAX measure like this:

DAXCopy code

TotalFlow = SUM(FlowData[Value])

Step 4: Visualization Setup

Now, let’s create the Sankey chart visualization:

  1. Drag the “Source” field to the “From” bucket.
  2. Drag the “Target” field to the “To” bucket.
  3. Drag the “Value” field to the “Weight” bucket.
  4. Customize the visualization properties as needed, such as colors, labels, and tooltips.

Below is the Code to create Multi level Sankey chart which is used in the below video!

Sankey =
UNION(
SUMMARIZE(
SELECTCOLUMNS(Orders,"Source",Orders[Category],"Target",Orders[Region]),
[Source],
[Target],
"Sales", SUM(Orders[Sales])),

SUMMARIZE(
SELECTCOLUMNS(Orders,"Source",Orders[Region],"Target",Orders[Segment]),
[Source],
[Target],
"Sales", SUM(Orders[Sales])),

SUMMARIZE(
    SELECTCOLUMNS(Orders,"Source", Orders[Segment], "Target", Orders[State]),
    [Source],
    [Target],
    "Sales", SUM(Orders[Sales])),

  SUMMARIZE(
    SELECTCOLUMNS(Orders,"Source", Orders[State], "Target", Orders[City]),
    [Source],
    [Target],
    "Sales", SUM(Orders[Sales])))