---
title: Power Automate で 集合！
tags:  #power automate #power platform  
author: [ふらり](https://www.docswell.com/user/fworlddocs)
site: [Docswell](https://www.docswell.com/)
thumbnail: https://bcdn.docswell.com/page/PEXPVK187X.jpg?width=480
description: 気ままに勉強会 #79 気ままになんでもLT会～ 第2回 ～ で登壇させて頂いたLT資料です。 イベントURL : https://kimamani.connpass.com/event/312301/ Power Automate のクラウドフローで数学の集合を使ってデータ操作するフローを説明しています！
published: March 24, 24
canonical: https://www.docswell.com/s/fworlddocs/ZM1DNX-2024-03-24-180536
---
# Page. 1

![Page Image](https://bcdn.docswell.com/page/PEXPVK187X.jpg)

Power Automate で 集合！
データ操作の話
ふらり@ROBO BOY
気ままに勉強会 #79
2024/03/16


# Page. 2

![Page Image](https://bcdn.docswell.com/page/3EKDQ52LJD.jpg)

ふらり @ ROBO BOY
Community : ふらっと純喫茶 、気ままに勉強会
X : https://twitter.com/flali_world
Blog : https://flali.hatenablog.com/
Docswell : https://www.docswell.com/user/fworlddocs
@flali_world
2


# Page. 3

![Page Image](https://bcdn.docswell.com/page/L73RPK46J5.jpg)

はじめに
本資料に掲載されている内容は、
いつか人になりたいと思っている
の空想上の出来事です。
内容間違っていたらごめんなさい。
@flali_world
3


# Page. 4

![Page Image](https://bcdn.docswell.com/page/87DYL3QM7G.jpg)

あじぇんだ
1. 集合！
2. LEVEL.1 和集合、積集合
3. LEVEL.2 差集合
4. LEVEL.3 対称差集合
5. さいごに
@flali_world
4


# Page. 5

![Page Image](https://bcdn.docswell.com/page/VJP624LQE8.jpg)

集合！
和集合、積集合
5


# Page. 6

![Page Image](https://bcdn.docswell.com/page/2EV3DXQP7Q.jpg)

Microsoft Power Platform
Power BI
Power Apps
Power Automate
Power Pages
Copilot Studio
Business analytics
Application development
Workflow automation
Business website
Intelligent Copilots
• Canvas Apps
• Model-driven Apps
Microsoft Dataverse
Power FX
• Cloud Flows &amp; Teams Flows
• Business Process Flows
• Desktop Flows
Managed
Environment
Data Connecters
AI Builder
@flali_world
6


# Page. 7

![Page Image](https://bcdn.docswell.com/page/57G3YVWQJL.jpg)

集合とは？
wikipadia より
集合（しゅうごう、英: set, 仏: ensemble, 独: Menge）とは数学
における概念の1つで、大雑把に言えばいくつかの「もの」からな
る「集まり」である。集合を構成する個々の「もの」のことを元
(げん、英: element; 要素) という。
和集合(union)
A
B
引用元:集合 - Wikipedia
@flali_world
7


# Page. 8

![Page Image](https://bcdn.docswell.com/page/4EQ5M63WJP.jpg)

4つの集合をやってみます！
和集合(union)
A
B
差集合 (difference)
A
B
積集合(intersection)
A
B
対称差集合(symmetric difference)
A
B
引用元:集合 - Wikipedia
@flali_world
8


# Page. 9

![Page Image](https://bcdn.docswell.com/page/KJ49V41171.jpg)

配列Aと配列B
配列Aと配列Bは下記のような要素を持っているとします。
配列A
配列B
[
[
&quot;111&quot;,
&quot;222&quot;,
&quot;333&quot;,
&quot;000&quot;
]
共通の
要素
&quot;444&quot;,
&quot;555&quot;,
&quot;666&quot;,
&quot;000&quot;
]
@flali_world
9


# Page. 10

![Page Image](https://bcdn.docswell.com/page/LE1K34G5JG.jpg)

配列A と 配列B を定義します。
変数の初期化アクションで、配列Aと配列Bを定義します。
配列A
配列B
@flali_world
10


# Page. 11

![Page Image](https://bcdn.docswell.com/page/GEWDPXKWJ2.jpg)

LEVEL.1
和集合(union)、積集合(intersection)
11


# Page. 12

![Page Image](https://bcdn.docswell.com/page/47ZGK6Z2E3.jpg)

和集合 (union)
配列Aと配列Bのすべてに含まれる要素。
ワークフロー関数での提供あり。(union関数)
すべての要素を取得したいときに便利です。重複を排除したい場合などにも使います。
[
&quot;111&quot;,
&quot;222&quot;,
&quot;333&quot;
]
A
[&quot;000&quot;]
B
[
&quot;444&quot;,
&quot;555&quot;,
&quot;666“
]
式関数のリファレンス ガイド - Azure Logic Apps | Microsoft Learn
@flali_world
12


# Page. 13

![Page Image](https://bcdn.docswell.com/page/YJ6YQ2867V.jpg)

Union 関数 (和集合)
union関数を使って簡単に取得できます！
式関数のリファレンス ガイド - Azure Logic Apps | Microsoft Learn
@flali_world
13


# Page. 14

![Page Image](https://bcdn.docswell.com/page/GJ5GR295J4.jpg)

積集合 (intersection)
配列Aと配列Bの共通要素のみ。
ワークフロー関数での提供あり。(interscetion関数)
共有の要素を取得したいときに便利です。
A
[&quot;000&quot;]
B
式関数のリファレンス ガイド - Azure Logic Apps | Microsoft Learn
@flali_world
14


# Page. 15

![Page Image](https://bcdn.docswell.com/page/LE3RPKY575.jpg)

intersection 関数 (積集合)
intersection関数を使って簡単に取得できます！
式関数のリファレンス ガイド - Azure Logic Apps | Microsoft Learn
@flali_world
15


# Page. 16

![Page Image](https://bcdn.docswell.com/page/8EDYL35YEG.jpg)

LEVEL.2
差集合
16


# Page. 17

![Page Image](https://bcdn.docswell.com/page/V7P624G2J8.jpg)

差集合 (difference)
差集合とは、配列Aと配列Bのうち、配列Aにのみ含まれる要素。
ワークフロー関数での提供はなし。アレイのフィルター処理アクションを利用することで実現可。
差分を取得したいときに便利です。
[
&quot;111&quot;,
&quot;222&quot;,
&quot;333&quot;
]
A
B
@flali_world
17


# Page. 18

![Page Image](https://bcdn.docswell.com/page/2JV3DX6XEQ.jpg)

アレイのフィルター処理をつかう(差集合 , differrence)
アレイのフィルター処理を使い、配列Bに配列A(Formで指定)の要素が含まれているを確認し
(contains(variables(‘配列B’),item()) 、含まれていない場合(is not equal to true)に該当する
要素を条件にフィルターすることで取得できる。
配列Bに配列Aのアイテムが含まれて(contains)いない(not)
@flali_world
18


# Page. 19

![Page Image](https://bcdn.docswell.com/page/5EG3YVNR7L.jpg)

LEVEL.3
対称差集合
19


# Page. 20

![Page Image](https://bcdn.docswell.com/page/4JQ5M6QY7P.jpg)

対称差集合(symmetric difference)
配列Aと配列Bのうち共通要素を含まない。
ワークフロー関数での提供はなし。フィルターアクションを利用することで実現可。
共通部分を含まなないすべての要素を取得できます。
[
&quot;111&quot;,
&quot;222&quot;,
&quot;333&quot;
]
A
B
[
&quot;444&quot;,
&quot;555&quot;,
&quot;666“
]
@flali_world
20


# Page. 21

![Page Image](https://bcdn.docswell.com/page/K749V4NZE1.jpg)

アレイのフィルター処理をつかう(対称差集合)
union関数を使い配列Aと配列Bに含まれる要素を取得する(Formで指定。和集合)。
intersection関数で配列Aと配列Bの共有部分の要素を取得(積集合)し、contains関数で和集合の
要素に積集合の要素が含まれていない場合に該当する要素を条件にフィルターすることで取得。
配列Bに配列Aのアイテムが含まれて(contains)いない(not)
@flali_world
21


# Page. 22

![Page Image](https://bcdn.docswell.com/page/LJ1K345D7G.jpg)

アレイのフィルター処理の内容(対称差集合)
union
[
&quot;111&quot;,
&quot;222&quot;,
&quot;333&quot;
From
]
A
[&quot;000&quot;]
B
[
&quot;444&quot;,
&quot;555&quot;,
&quot;666“
]
intersection
Filter Query
Contains(
含む
A
[&quot;000&quot;]
B
, item())
に該当 しない
is not equal to true
@flali_world
22


# Page. 23

![Page Image](https://bcdn.docswell.com/page/GJWDPX5872.jpg)

結果：対称差集合(symmetric difference)
結果、対称差集合が取得できます。
[
&quot;111&quot;,
&quot;222&quot;,
&quot;333&quot;
]
A
B
[
&quot;444&quot;,
&quot;555&quot;,
&quot;666“
]
@flali_world
23


# Page. 24

![Page Image](https://bcdn.docswell.com/page/4EZGK6N9J3.jpg)

2.さいごに


# Page. 25

![Page Image](https://bcdn.docswell.com/page/Y76YQ28DEV.jpg)

さいごに
オブジェクト型にも使えるよ！
数学的知識だいじ！
工夫や組み合わせでいろいろできる！
@flali_world
25


# Page. 26

![Page Image](https://bcdn.docswell.com/page/G75GR29874.jpg)

Thank you !
※ Microsoft、Microsoft 365、Office 365、Microsoft Dynamics、Microsoft Azure 、Power Platform 、 Power Apps、Power Automate、Power BI、Microsoft Dataverse 及び関連する名称並びにそれぞれのロゴは、米国 Microsoft
Corporationの米国およびその他の国における登録商標です。※ QRコードの商標はデンソーウェーブの登録商標です。


