在Power BI中创建网络图

时间:2020-05-03 07:15:29

标签: powerbi dax

我正在尝试在Power BI中创建网络图。我知道这需要一个来源,一个目标和价值作为权重。以下是样本数据。实际数据相似但有所不同。

您可以在“测试”列中看到

值C和G在键9和5中出现两次。

值A和G在键7和11中出现两次,但11中也有F。

值F和G在11和13中一起出现两次,但11也包含A。

public function all(array $attributes)
    {
        $rates = $this->model->query()->where([
            ['able_type', $attributes['type']],
            ['able_id', $attributes['type_id']]
        ])
            ->get(['rate']);

    return [
        'count' => $rates->count(),
        'average' => $rates->avg('rate')
    ];

}

public function show($attributes)
{
    $result = $this->model->query()->where([
        ['user_id', $attributes['user_id']],
        ['able_type', $attributes['type']],
        ['able_id', $attributes['type_id']]
    ])
        ->first();

    return $result;
}

我要创建表格或度量

Key      Test 
1          A
3          B
5          C
5          G
7          A
7          G
9          C
9          G
11         G
11         A
11         F
13         F
13         G

以便我可以创建网络图

0 个答案:

没有答案