Quantcast
Channel: TechNet Blogs
Viewing all 34890 articles
Browse latest View live

Hyper-V レプリカと Windows Server バックアップを併用する際の注意点

$
0
0

こんにちは。
Windows プラットフォーム サポート担当の佐々木です。
今回は、Hyper-V レプリカと Windows Server バックアップを併用する際に、レプリケーションが停止する事象についてご案内させていただきます。

■レプリケーションとは?

コンピュータやソフトウェアの管理するデータと同じ内容のレプリカ(複製)を作成することです。
ホストサーバのデータ情報と作成したレプリカの内容を定期的に同期するため、万が一ホストサーバに障害が発生した場合でも、
作成したレプリカからシステムを稼働し続けることができます。
そのため、レプリケーションを行うことでシステムの高可用性を高めることにつながります。

■Hyper-V レプリカとは?

Hyper -V レプリカは、 Windows Server 2012から実装された Hyper-V の機能の一部です。
Hyper-V ホストで作成した仮想マシンでHyper-Vレプリカの機能を有効にすると、
Hyper-Vホストの仮想マシンのレプリカがHyper-V レプリカに作成され、随時レプリケーションを行うことができます。

■対象 OS

Windows Server 2012
Windows Server 2012 R2
Windows Server 2016

■Hyper-V レプリカと Windows Server バックアップを併用する際の注意点

Windows Server 標準の Windows Server バックアップでは Hyper-V レプリカ環境のバックアップには対応しておりません。

そのため、Hyper-V レプリカでレプリケーションを行っている際に
Windows Server バックアップにて仮想マシンのバックアップを実行すると
Hyper-V レプリカとHyper-V ホストのレプリケーションが切断される事象が発生することがございます。

■対応策

Hyper-V レプリカに対応したバックアップアプリケーションのご利用をご検討ください。
弊社製品では、System Center Data Protection Manager (DPM) 2012 R2 以降のバージョンから対応しております。

また、以下の2点を考慮することで回避することができます。

①バックアップの開始前にレプリケーションを一時停止する。
②バックアップ完了後、レプリケーションを再開する。

※レプリケーションの再開 / 一時停止は、以下の PowerShellコマンドにより実行することができます。

レプリケーションの再開  :Resume-VMReplication
レプリケーションの一時停止:Suspend-VMReplication

参考:
Hyper-V 仮想マシンのバックアップ
https://docs.microsoft.com/ja-jp/system-center/dpm/back-up-hyper-v-virtual-machines?view=sc-dpm-1807

Suspend-VMReplication
https://docs.microsoft.com/en-us/powershell/module/hyper-v/suspend-vmreplication

Resume-VMReplication
https://docs.microsoft.com/en-us/powershell/module/hyper-v/resume-vmreplication

いかがでしたでしょうか。
本ブログが少しでも皆様のお役に立つと幸いです。

本情報の内容(添付文書、リンク先などを含む)は、作成日時点でのものであり、予告なく変更される場合があります。


[Power BI] DAX入門 (1) まずはここを見よう リンク集

$
0
0

この記事は、2016 年 6 月 20 日 に Data Platform Tech Sales Team Blog にて公開された内容です。

 

Microsoft Japan Data Platform Tech Sales Team

土井

■DAX とは

Data Analysis Expressions (DAX) 言語は、Microsoft SQL Server Analysis Services (SSAS) や Excel の Power Pivot、Power BI Desktop で数式や式を作成するための部品として使用できる関数や演算子のライブラリです。DAX にはさまざまな種類の関数があり、 たとえば前年比の算出やカレンダーテーブルの作成などに必要なタイムインテリジェンス関数や IF, SWITCH などの論理関数、COUNT, RANKX などの集計関数等があります。

Excel ライクに記述が可能なため、比較的馴染みやすいのが特徴ですが、とはいえ、DAX の基本的な使い方や関数の一覧についてなかなかまとまった情報が見つかりにくい、というお問合せをよくいただくため、今回はまず第一弾として参考になるであろう各種リンクのご紹介を致します。

■日本語ナレッジ

[Data Analysis Expressions (DAX) リファレンス]
https://msdn.microsoft.com/library/gg413422.aspx
まずは何といっても公式のリファレンスです。慣れてくるとこのリファレンスが一番しっくりきますが、はじめて触る方にとっては少しハードルが高いかもしれません。中級~上級者向けです。
 

[Power BI Desktop における DAX の基本事項]
https://powerbi.microsoft.com/ja-jp/documentation/powerbi-desktop-quickstart-learn-dax-basics/
Power BI Desktop における、とありますが、SSAS や PowerPivot でも同様です。初心者向けの内容になってます。
 

[SQL Server 自習書 Analysis Services によるインメモリ BI 入門] (PDF)
http://go.microsoft.com/?linkid=9820057
P.75 (3.4 DAX 式を利用したメジャーの作成(比率や前年金額などの計算)) あたり。初心者向けです。
 

[Power BI Desktop を使って訪日外国人 (インバウンド) 統計データを可視化する]
http://blogs.msdn.microsoft.com/dataplatjp/?p=995
よく使う累計や前年比について触れています。サンプルファイルもダウンロードいただけます。初心者向けです。
 

■英語ナレッジ

[DAX Resource Center]
http://social.technet.microsoft.com/wiki/contents/articles/1088.dax-resource-center.aspx
DAX に関連する各種リソースをまとめています。Excel 2010 PowerPivot に関する内容が多いですが、SSAS や Power BI Desktop でも問題なく利用できます。
 

[DAX in the BI Tabular Model Whitepaper and Samples]
https://www.microsoft.com/en-us/download/details.aspx?id=28572
上記のリソースセンターの中で、有用と思われるサンプルコンテンツです。PowerPivot のサンプルファイルと、ホワイトペーパー 「Data Analysis Expressions (DAX) In PowerPivot for Excel 2010」 をダウンロードできます。
 

[Dax Patterns]
http://www.daxpatterns.com/usecases/
逆引きで DAX パターンを調べることができます。Excel 2010, 2013 のサンプルファイルもダウンロードできます。
 

■英語動画

[DAX 101] 初心者向け
https://www.youtube.com/watch?v=klQAZLr5vxA
 

[Advanced DAX ] 上級者向け
https://www.youtube.com/watch?v=6ncHnWMEdic
 

[Analyzing and Visualizing Data with Excel] 初心者向け
https://mva.microsoft.com/en-US/training-courses/analyzing-and-visualizing-data-with-excel-11157?l=OXUnAHXPB_2505095270

Topic2 The Excel Data Model and Basic DAX 8:50
Topic5 Advanced DAX 12:25

PowerPivot にフォーカスした内容です。字幕をオンにすることもできます。
 

■まとめ

第一弾では各種リンクの紹介をいたしました。今後、よく使われる関数について具体的な使い方について記事を書いていきたいと思っていますので、ご期待ください。

関連記事
DAX 入門
https://blogs.msdn.microsoft.com/dataplatjp/dax/
 

[Power BI] DAX入門 (2) カレンダーテーブルの作成

$
0
0

この記事は、2016 年 7 月 11 日 に Data Platform Tech Sales Team Blog にて公開された内容です。

 

Microsoft Japan Data Platform Tech Sales Team

土井

DAX 入門 第二回目では、カレンダーテーブルを生成するための日付と時刻の関数と、それに付随して文字列関数と論理関数について具体的に触れていきます。 (本記事で作成するサンプルファイルは こちら からダウンロードいただけます。)

■なぜカレンダーテーブルが必要か

カレンダーテーブルを作成することで、年ごと、四半期ごと、月ごと、週ごと、といった形で任意の時系列単位でデータを集計することが可能になります。同様の意味で、 "タイム ディメンション" と言ったり、"時間階層" と言ったり "日付マスタ" と言ったりしますが、ここでは "カレンダーテーブル" として統一します。

Power BI Desktop や PowerPivot も含め、多くの BI ツールでは 分析に使用するデータの中に date 型の列があれば、カレンダーテーブルを自動的に (暗黙的に) 作成する機能を持っていますが、意図した仕様とは異なったものになっており、結局イチからカレンダーテーブルを作成しないといけない、といったことも多々あります。たとえば一週間の曜日始まりを月曜として週単位で集計したいのに、日曜始まりとなってしまっていたり、曜日表記を英語ではなく日本語で表示したかったり、前年同日ではなく前年同曜日を算出したいといった場合等が挙げられます。
 

■CALENDAR 関数

CALENDAR 関数 は SQL Server 2016 Analysis Services (SSAS), Power Pivot in Excel 2016, そして Power BI Desktop で提供されている新しい DAX 関数で、開始日と終了日を指定して、date 型の列を生成することができます。以降、本記事では Power BI Desktop を例に進めますが、SSAS や PowerPivot でも同様のことができるようになっています。

Power BI Desktop を立ち上げて、”モデリング”タブから”新しいテーブル”をクリックします。

image

数式ペインに以下の式を入力します。

カレンダー = CALENDAR("2015/1/1", TODAY())

image

TODAY 関数 は現在の日付を返します。時刻は 0:00:00 となります。

類似の関数として NOW 関数 があります。こちらは時刻もその時点の時刻として反映されます。Power BI Service でスケジュール更新されるレポートに更新日時を表示する際等に最適です。
 

新しいテーブルが作成され、2015/1/1~本日までの date 型の列を持つテーブルが作成されました。

image
 

■日付と時刻の関数

さきほど作成した Date 列を基に、集計したい単位の列を DAX 関数を使って生成します。日付と時刻の関数 (DAX) の中から以下の関数を使用します。
 

YEAR 関数 ・・・ 日付の年を 4 桁の整数として返します。範囲は 1900 ~ 9999 です。

年 = YEAR([Date])

 

MONTH 関数 ・・・ 1 (1 月) から 12 (12 月) までの数値として月を返します。

月番号 = MONTH([Date])

 

WEEKDAY 関数 ・・・ 日付に対応する曜日を return_type 値に従って返します。 既定では、曜日の範囲は 1 (日曜日) ~ 7 (土曜日) です。

曜日番号 = WEEKDAY([Date], <return_type>)
return_type 週の始まり
1 (既定) 週の始まりを日曜日 (1)、終わりを土曜日 (7) とします。
2 週の始まりを月曜日 (1)、終わりを日曜日 (7) とします。
3 週の始まりを月曜日 (0)、終わりを日曜日 (6) とします。

 

WEEKNUM 関数 ・・・ 特定の日付が第何週目に当たるかを返します。 たとえば、1 月 1 日を含む週がその年の最初の週で、第 1 週になります。

この関数で使用されるシステムには、次の 2 種類があります。

  • システム 1 1 月 1 日を含む週がその年の最初の週であり、第 1 週です。
  • システム 2 その年の最初の木曜日を含む週がその年の最初の週であり、第 1 週です。 このシステムは、ヨーロッパ式週番号システムと呼ばれる、ISO 8601 に規定されている方式です。
週番号 = WEEKNUM([Date], <return_type>)
return_type 週の始まり システム
1 or 17 (既定) 日曜日 1
2 or 11 月曜日 1
12 火曜日 1
13 水曜日 1
14 木曜日 1
15 金曜日 1
16 土曜日 1
21 月曜日 2 (ISO week date)

※WEEKNUM 関数については Excel 関数におけるガイド も合わせて参照ください。
 

上記 4 つの DAX 関数を使って、Power BI Desktop で新しい列 を作成すると、以下のようになります。

(ここでは WEEKDAY 関数の return_type は 2、WEEKNUM 関数の return_type は 21 としています)

image
 

■文字列関数と論理関数

文字列関数論理関数 を使って日本式なカレンダーテーブルを作成していきます。まず文字列関数の FORMAT 関数 を使って、

月 = FORMAT([Date],"M月")
年月 = FORMAT([Date],"YYYY年MM月")

を作成します。FORMAT 関数のカスタム日付/時刻書式 も合わせて参照ください。

以下のように列が追加されます。このとき、”月” 列を選択した状態で、”列で並び替え”をクリックし、”月番号”を選択します。

image

これにより、”月” 列のソート順は “月番号” 列によってコントロールされることになります。たとえば、商品名の列を商品 ID 順にソートしたい、といった場合でも同様に設定が可能です。
 

次に、論理関数の Switch 関数IF 関数 を使って日本式の “曜日”、”会計年度”、”四半期” 列を作成します。(ここでは年度始まりを 4 月としています)

曜日 = SWITCH([曜日番号], 1, "月", 2, "火", 3, "水", 4, "木", 5, "金", 6, "土", 7, "日","")
会計年度 = IF([月番号]<4,[年]-1,[年])
四半期 = IF([月番号]<4,"Q4",IF([月番号]<7,"Q1",IF([月番号]<10,"Q2","Q3")))

image

さきほどと同様に、”曜日” 列を選択して ”曜日番号” で並べ替えされるように設定しておきます。
 

最後に、冒頭で自動で生成された “Date” 列の名前を ”日付” に変更しておきます。

image

列の名前が変わっても、これまで作成してきた “Date” 列を参照した式がすべて自動で “日付”に変わるので、エラーは起きません。

image
 

■まとめ

本記事では、よく使われる DAX 関数を使ってカレンダーテーブルを作成する方法についてご紹介いたしました。論理関数や文字列関数等はカレンダーテーブル以外にも応用可能なので、是非お手元のデータで試してみてください。

なお、今回作成したサンプルファイルは こちら からダウンロードいただけます。

 

Kalenderwoche 42/2018 für IT-Experten im Rückblick: Azure Digital Twins, Azure IoT, Azure Data Studio und mehr

$
0
0

Was hat sich in der vergangenen Woche für IT-Professionals getan? Gab es wichtige Ankündigungen oder neue Wissensressourcen? Unser TechNet Blog-Team hat zehn interessante Links für Sie zusammengestellt. Viel Spaß beim Stöbern!

 

Announcing Support for Controlled Connections to Public Folders in Outlook

$
0
0

Up to now, Administrators did not have control over which users would see public folders in their Outlook clients. If public folders were created within the organization or if an Exchange Online organization is configured to access on-premises public folders, all clients would make a connection to and show the “Public folders” object in Outlook. From there, one could control access to individual public folders (controlled through folder permissions). However, it was difficult to have only some of Outlook clients connect to public folders.

We are now introducing the ability to show the public folder object in Outlook to only a set of users who might need them. To get started, this will be available for Outlook for Windows users only.

To do this, administrators can use two parameters:

  • PublicFolderClientAccess is an optional parameter on the user object. By default, its value is set to ‘false’. Setting this to ‘true’ on a specific user designates this user as one of users who will see public folders in Outlook.
  • PublicFolderShowClientControl parameter on the organization config. By default, the value of this parameter is also ‘false’ and once it is set to ‘true’, the controlled access of public folders is enabled.

Here is an example of how to use these parameters; to enable access to only the user “Administrator” and turn the feature on for the organization:

Set-CASMailbox “Administrator" -PublicFolderClientAccess $true
Set-OrganizationConfig -PublicFolderShowClientControl $true

Important note: setting the organization parameter to true without setting user attributes to true first will make it so no users will see the public folder object in Outlook for Windows. In other words – if you want to implement this, we suggest that you plan ahead and populate user attributes first (PublicFolderClientAccess on users that need access set to true) and then set the organization level parameter (PublicFolderShowClientControl set to true). That way, users who need to have access will not lose access unexpectedly.

Why would you want to do this?

Tenant admins will now have more flexibility over which users connect to public folders in Outlook. This will benefit very large organizations who might have issues with connection limits to public folders and will reduce the load to that infrastructure.

This will also be helpful to organizations during mergers and acquisitions if moving to EXO. Imagine one organization having existing public folders, but after the companies merge – without this feature all of the users would unnecessarily connect to the public folder hierarchy.

Note: This feature is not intended to be replacement for public folder permissions, it is merely providing means to have more control over which clients connect to the public folder tree.

A few more questions answered that you might be interested in:

Will this work for only Outlook on Windows?

At this time, yes. We are working to bring this to additional clients (like Outlook for Mac or Outlook on the web) in the future and will talk about this later.

What about on-premises servers?

We are considering support for on-premises in a future CUs and we will provide details at the later time.

Is there a specific version of Outlook that I need to see changed behavior?

No. The feature works by removing the public folder information from the Autodiscover response to Outlook for Windows clients. Therefore, if the user is not enabled for public folder access they will simply not connect to the public folder tree no matter the version of Outlook for Windows they use.

In case of any questions, please do reach out to us via the comments section below. We are updating official documentation to add those parameters.

Public folder team

This Blog Is Now Retired

$
0
0

Hello Everyone

We have retired this blog. We are now blogging on a new Configuration Manager blog on the Microsoft TechCommunity located here: https://techcommunity.microsoft.com/t5/Configuration-Manager-Blog/bg-p/ConfigurationManagerBlog

Join us there for informative and best practice posts from the Configuration Manager team.

To get started:

  1. Create your account on the Microsoft TechCommunity
  2. Join the System Center Configuration Manager community
  3. Follow our new blog
  4. Add your contributions and comments to our discussion space

Note: This TechNet blog will remain in place for a period to allow access to historical blog posts but no further updates will be made here.

See you over on the TechCommunity.

-Yvette

This Blog Is Now Retired

$
0
0

Hello Everyone

We have retired this blog. We are now blogging as part of the new Configuration Manager blog on the Microsoft TechCommunity located here: https://techcommunity.microsoft.com/t5/Configuration-Manager-Blog/bg-p/ConfigurationManagerBlog

Join us there for announcements and best practice posts from the MDT team.

To get started:

  1. Create your account on the Microsoft TechCommunity
  2. Join the System Center Configuration Manager community
  3. Follow our new blog
  4. Add your contributions and comments to our discussion space

Note: This TechNet blog will remain in place for a period to allow access to historical blog posts but no further updates will be made here.

See you over on the TechCommunity.

-Yvette

Don’t forget the provider!!!

$
0
0

I have seen across the internet where folks have been frustrated, unable to remove a site system that used to perform some role in SCCM.  The prior role (DP, MP, etc.) was removed and now it only has two roles listed, "Component Server" and "Site System".  When attempting to delete it  you can't, because of the component server role still being listed.  Restarting the SMS_SITE_COMPONENT_MANAGER is a suggested step to take to get the component server role to clear and allow the deletion, but in some cases that won't work.  Why not?  Well.., the component server role is there for good reason..., there is still an active ConfigMgr component on the box.  Sure.. it no longer lists as a "site database server" or "management point" but it does have a function running on the machine.  There is one role that does not display through this area of the UI...., the provider!

To see what servers have the provider on them you need to navigate in the ConfigMgr Admin UI to AdministrationOverviewSite ConfigurationSites and bring up properties on the site that owns the site system.  If that is your hold up, then it is time to run your ConfigMgr setup and move your provider to a new location.


Horário de verão no Brasil 2018 – Como isso afeta o calendário de clientes do Microsoft Exchange e Office 365

$
0
0

Sobre o horário de verão 2018:
==========================================

Conforme última atualização do decreto 6658, o horário de verão brasileiro está definido da seguinte forma:
Horário de verão inicia no primeiro domingo de novembro (dia 04) às 00:00:00
Horário de verão termina no terceiro domingo de fevereiro (dia 17) às 00:00:00
Para suportar estas alterações de horário de verão, a Microsoft disponibilizou desde abril de 2018 as atualizações para as versões de sistemas operacionais suportadas.
Segue abaixo o artigo oficial sobre a atualização;
#  Time zone and DST changes in Windows for Brazil, Morocco, and São Tomé and Príncipe
https://support.microsoft.com/en-us/help/4093753/time-zone-and-dst-changes-in-windows-for-brazil-morocco-and-sao-tome-a
* É possível que outras atualizações tenham substituído esta atualização. Consultar o site do Catalog para ver o último kb válido.

Como esta mudança afeta os clientes de Exchange / Office 365?
==========================================

Os clientes de correio trabalham de maneiras diferentes.
  • Outlook: irá utilizar a informação de fuso horário da máquina local para ajustar as reuniões. Se o Sistema Operacional estiver devidamente atualizado, o Outlook irá mostrar as reuniões com o horário correto.
  • OWA: O cliente OWA utiliza as informações de fuso horário do servidor. Isto significa que usuários do OWA necessitam que a atualização de fuso horário esteja aplicada em todos os servidores Exchange da organização.
  • ActiveSync: O ajuste dos compromissos no calendário dos dispositivos móveis dependem de atualização no S.O. do próprio dispositivo.
* Os servidores do Office 365 já estão atualizados com as últimas definições de horário de verão.

Informações adicionais
==========================================

Ao criar compromissos baseados em Exchange / Office 365, a solicitação da reunião inclui informações do horário de verão do organizador da reunião, ou seja, ao criar uma solicitação de reunião de uma estação de trabalho, o Outlook vai incluir o fuso horário do organizador e informações de quando o horário de verão começa e termina. Neste caso, mesmo que você tenha uma reunião recorrente que foi criada antes de sair a atualização do horário de verão, o cliente de correio tem que ser capaz de recalcular o horário do compromisso baseado nas informações atualizadas do SO da estação de trabalho ou servidor (dependendo do cliente utilizado).
Pode acontecer em alguns casos de compromissos seguirem com a data incorreta, principalmente no período Delta (período de alteração entre a antiga data de horário de verão e a nova data – neste ano de 2018 entre 21 de outubro a 03 de novembro), como se respeitasse o horário de verão de antes da atualização. Para estes casos o melhor é avaliar os compromissos individualmente, o maior motivo para isso acontecer é alguma propriedade do compromisso estar ausente ou corrompida, que pode gerar ainda resultados distintos para o mesmo compromisso se comparados em clientes diferentes como Outlook e OWA.
Para estes casos, a recomendação é rodar a ferramenta Calendar Checking Tool for Outlook (CalCheck) no calendário afetado.
https://www.microsoft.com/en-us/download/details.aspx?id=28786
A ferramenta irá gerar um relatório no formato *.csv. Verifique se o compromisso afetado está listado no relatório. Somente compromissos com erro aparecem no relatório.
Consulte o site abaixo para ver a relação dos erros e as respectivas soluções;
https://support.microsoft.com/en-us/help/2678030/information-about-the-calendar-checking-tool-for-outlook-calcheck

Para confirmar se a atualização do horário de verão foi aplicada no Windows, você pode utilizar o comando abaixo;
Antes do KB instalado:
w32tm /tz
Time zone: Current:TIME_ZONE_ID_STANDARD Bias: 180min (UTC=LocalTime+Bias)
[Standard Name:"E. South America Standard Time" Bias:0min Date:(M:2 D:3 DoW:6)]
[Daylight Name:"E. South America Daylight Time" Bias:-60min Date:(M:10 D:3 DoW:6)]
 
Após KB instalado:
w32tm /tz
Time zone: Current:TIME_ZONE_ID_STANDARD Bias: 180min (UTC=LocalTime+Bias)
[Standard Name:"E. South America Standard Time" Bias:0min Date:(M:2 D:3 DoW:6)]
[Daylight Name:"E. South America Daylight Time" Bias:-60min Date:(M:11 D:1 DoW:6)]

Artigos relacionados:
==========================================

# Decreto Oficial com as datas de horário de verão:
https://www.planalto.gov.br/ccivil_03/_Ato2007-2010/2008/Decreto/D6558.htm
# Horário de verão no Brasil inicia em 04 de Novembro de 2018 (lista de KBs)
https://blogs.technet.microsoft.com/latam/2018/10/17/horario-de-verao-no-brasil-inicia-em-04-de-novembro-de-2018-lista-de-kbs/
# How time zone normalization works in Microsoft Outlook
https://support.microsoft.com/en-us/help/2642044/how-time-zone-normalization-works-in-microsoft-outlook
# Information about the Calendar Checking Tool for Outlook (CalCheck)
https://support.microsoft.com/pt-br/help/2678030/information-about-the-calendar-checking-tool-for-outlook-calcheck

Runspace twospace, redspace bluespace…

$
0
0

This is the final of four posts on ways to accomplish parallel processing.  In the previous posts, we looked at using Jobs (or -AsJob), and WorkFlows.   Following the theme of those prior posts, we'll take a look at Runspaces, specifically under the microscope of looking at how the processes and threads are handled to see if it operates as we would think a true multithreaded application would work.

If you are looking for a basic how-to on runspaces. take a look at Boe Prox's article on TechNet for a good tutorial on how runspaces work.

I have to admit that before taking on this task to compare the different parallel processing methods of PowerShell, I had never heard of runspaces.  For me, it was the toughest parallel processing method to learn.  Don't let that dissuade you from taking on the challenge of learning this, the juice is definitely worth the squeeze.

Example Code

The script below is an example of a runspace that basically connects to all servers in my test lab and queries the security event logs for the latest 4000 event 4624s (successful logons).  The code to execute on the remote servers is in the scriptblock toward the bottom of the script and is passed as a scriptblock object parameter to the function higher in the script.

# RUNSPACE SAMPE

Function Process-Parallel($arr, $SB) 
{ 
    # CREATE THE RUNSPACE POOL
    $RunspacePool = [RunspaceFactory]::CreateRunspacePool(1,10) 
    
    # OPEN THE RUNSPACE POOL 
    $RunspacePool.Open()
 
    # CREATE THE RUNSPACE COLLECTION
    $RunspaceCollection = New-Object system.collections.arraylist 
    ForEach ($obj in $arr) 
    { 
        # CREATE A POWERSHELL OBJECT  
        $Powershell = [PowerShell]::Create()
 
        $Powershell.RunspacePool = $RunspacePool 
        $Powershell.AddScript($SB) | Out-Null 
        $Powershell.AddArgument($obj) | Out-Null 

        # CREATE THE RUNSPACE OBJECT
        $RS = New-Object -TypeName PSObject -Property @{
            Runspace = $PowerShell.BeginInvoke() 
            PowerShell = $PowerShell 
        } 
    
        $RunspaceCollection.Add($RS) | Out-Null 
    }

    # CREATE A RETURN ARRAY
    $Return = @() 

    While($RunspaceCollection) 
    {
        # GO THROUGH ALL THE RUNSPACES IN THE COLLECTION 
        ForEach($Runspace in $RunspaceCollection.ToArray())
        {
            # CHECK TO SEE IF RUNSPACE COMPLETED
            If($Runspace.RunSpace.IsCompleted -eq $true)
            {
                # ASSIGN THE RESULT TO $return
                $Return += $Runspace.Powershell.EndInvoke($Runspace.RunSpace) 
                $Runspace.Powershell.dispose() 
                $RunspaceCollection.Remove($Runspace)
            }
        }
    }
    Return $Return 
}

#  GET THE COMPUTERS TO BE CHECKED
$arr = get-adcomputer -filter * -server dc1.contoso.com:3268 

#  PUT TOGETHER SCRIPTBLOCK TO RUN
$SB = { 
    param($Computer) 
    $strCompName = $Computer.Name 
    $Count = (Get-Eventlog Security -ComputerName $Computer.Name -Newest 4000| `Where-Object {$_.EventID -eq '4624'}).count
    Return "$strCompName,$Count"
}

#  EXECUTE THE COMMAND
$Stats = Measure-Command {$OutTest = process-parallel $arr $SB} 

$OutTest 

$Stats

The Analysis

Using ProcMon from the SysInternals Tools Suite, I captured the execution of this script.  As you can see from the capture screenshot below, the runspace ran under a single PowerShell_ISE process, unlike the captures that we looked at with Jobs and WorkFlows (using InlineScript).  This gives runspaces an advantage since they do not consume excessive resources with multiple PowerShell environments.

 

In the filtered ProcMon capture below, you can see that the single PowerShell process ID spawns multiple threads to do the parallel processing, truly multi-threaded.

Now, the important part, the performance.  The runspace was blazing fast, executing the query in 37 seconds.  To give a frame of reference, execution times for  the exact same task with the different methods is listed below:

  • ForEach loop took 1 minute and 23 seconds
  •  Jobs took 1 minute and 20 seconds
  • WorkFlow took 1 minute and 17 seconds
  • RunSpace took 37 seconds

Just plain wow!!  I did have to tweak the Maximum number of runspaces  (2nd number in parenthesis below) to see what combination worked best for my environment.  My lab is just a normal desktop running 20 VMs, so it is pretty taxed at most times.  Your mileage may vary.

$RunspacePool = [RunspaceFactory]::CreateRunspacePool(1,10)

Now What?

The thing you have to consider with workflows is that there is a steep learning curve when compared to the other methods listed above.  In my experience, I tend to put that kind of effort into scripts that will return a dividend on the time investment.  It really comes down to your use case for the script.  If you need blazing fast performance and have the time and skillset to learn and embrace it, this is the only choice.

 

Happy Scripting!!

Windows 7/Office 2010 サポート終了を踏まえた Microsoft 365 への移行支援施策/キャンペーン【10/20 更新】

$
0
0

日本マイクロソフトでは、2020年1月14日に Windows 7、同年10月13日にOffice 2010のサポートを終了させていただきます。

買い替えや新規でのご購入を考えているなら、最新の Windows OS ※ と Office が使え、サポートの心配も不要の Microsoft 365 Business、および Office 365 Business Premium がオススメです。今なら、200 社限定で対象製品をご購入後、アンケートにお答えいただいた企業に、初回購入特典として最大で 1,000,000 円キャッシュバック (返金) いたします。

※ Office 365 Business Premium には含まれません。

 

キャンペーンの詳細及びお申込みはこちら

 

関連項目

 

 

 

[Power BI] DAX入門 (3) 相対日付 (Relative date) の実装 -地震速報の可視化-

$
0
0

この記事は、2016 年 7 月 25 日 に Data Platform Tech Sales Team Blog にて公開された内容です。

 

Microsoft Japan Data Platform Tech Sales Team

土井

DAX 入門 第 3 回目では、前回の応用として、相対日付の実装について触れます。

今回は 地震速報 データを使って、今日何時に地震が起きたか? 昨日起きた地震の最大震度は? 直近一週間何件地震があったか?といった形で相対日付で可視化するレポートを作ってみます。

作成するレポートは以下のようなイメージです。スマホで閲覧されている場合は こちらのリンク を参照ください

 

■データの取得

まず、前回の記事で作成したカレンダーテーブルを使うので こちら からダウンロードください。

pbix ファイルを開いて、”データを取得” メニューから “Web” を選択します。

image

 

URL に http://typhoon.yahoo.co.jp/weather/jp/earthquake/list/ を入力し、OK をクリックします。 (データ出典:Yahoo! Japan 天気・災害)

image

 

ナビゲーター画面では “Table 0” のチェックボックスを選択し、”編集”をクリックします。

image

 

■データの加工

取得したデータを分析しやすい形にするため、加工をしていきます。

まず、“発生時刻” 列を選択した状態で、”変換” メニューの ”値の置換” をクリックし、”ごろ” を削除します。

image image

 

“ホーム” メニューから ”データ型” を選択し、”日付/時刻” に設定します。これにより、日付・時刻に関する各種 DAX 関数が利用可能になります。

image

 

“列の追加” メニューから”日付”->“日付のみ” を選択します。

image

 

同様に “時刻” を追加します

image

 

次に “震源地” 列を地図上で可視化できるように加工していきます。

実際には緯度・経度を基に地図上にプロットすべきですが、ここではあくまでサンプルのため、都道府県名でプロットするよう加工していきます。

“震源地” 列をクリックして、”変換” メニューから “値の置換” をクリックします。

image

検索する値 = 県

置換後 = 県,

とし、OK をクリックします。

image

 

さらに、”列の分割” –> “区切り記号による分割” を選択し、

image

 

コンマで列を区切ります

image

 

震源地.2 列は不要なので、削除します。

image

 

次に、震源地.1 列を選択した状態で、”列の追加” メニューから “条件列” を選択します。

image

 

下記のように 1 都 1 道 2 府を例外処理します。また、都道府県名を含まない震源地については、今回は “その他” として処理します。

image

 

“震源地” 列が追加されました。 “震源地.1” 列は不要なので、削除します。

image

 

ここまでの加工のステップは全て “適用したステップ” として記録されています。プロパティから、クエリの名前を ”地震速報” と変更し、”ホーム” メニューから ”閉じて適用” をクリックします。

image image

 

カレンダーテーブルの ”日付” 列と地震速報テーブルの ”Date” 列のリレーションを張ります。

image

 

■相対日付列の作成

さて、前置きが長くなりましたが、ようやく本題に取り掛かります。

DATEDIFF 関数 を使ってふたつの日付型列から差を取得することができます。

DATEDIFF(<start_date>, <end_date>, <interval>)

※ interval には年、四半期、月、週、日、時、分、秒 のいずれかの単位を指定できます。

 

今回は下記のように、TODAY関数を使って本日から何日前か、を計算します。

DATEDIFF('カレンダー'[日付],TODAY(),DAY)

これと、SWITCH 関数や IF 関数を使ってカレンダーテーブルに対して列を追加していきます。たとえば、

相対日付 = SWITCH(DATEDIFF('カレンダー'[日付],TODAY(),DAY),0,"本日",1,"昨日",2,"おととい","3日以前")

あるいは

一週間以内 = IF(DATEDIFF('カレンダー'[日付],TODAY(),DAY)<=7,"TRUE","FALSE")

といった列を作成可能です。

 

また、前回の記事 で作成した週番号列を使って、相対週の算出もできます。

相対週 = SWITCH(IF('カレンダー'[年]-YEAR(TODAY())=0,WEEKNUM(TODAY(),21)-'カレンダー'[週番号],-1),0,"今週",1,"先週",2,"先々週","3週間以前")

 

これにより、冒頭のレポートのような、相対日付でのスライサーを配置することが可能になります。

image

 

■更新日時列の作成

今回のように、定期的にデータソースが更新される場合、更新日時をレポートに表示したいといった要件があるかと思います。

Power BI Desktop で現在の時刻を取得する方法はいくつかありますが、今回は DAX で取得する例をご紹介します。

“ホーム” メニューの “データの入力” をクリックします。

image

“テーブルの作成” 画面で、1 行 1 列目に適当な値を入れます。下記の例では “1” を入力しています。

テーブルの名称を ”更新日時” とし、”読み込み” をクリックします。

image

テーブルが作成されました。 “列1” 自体は不要なので、”レポートビューの非表示” で隠してしまいましょう。

image

 

“モデリング” メニューから “新しい列” をクリックし、以下のふたつの列を追加します。

image

更新日時 (UTC) = NOW()

 

更新日時 (UTC+9) = NOW()+9/24

NOW 関数 は実行環境のロケールにおける現在時刻を返します。 Power BI Desktop を日本語環境でお使いの場合は時差を意識する必要はありませんが、

クラウド (Power BI Service) にレポートを発行する場合、Power BI Service 内では UTC で時刻を取得する動きとなります。そのため、日本時間に合わせるために上記のような列を作成する必要があります。

 

これにより、冒頭のレポートのように、更新日時を表示することが可能になります。

image

 

■まとめ

記事がかなり長くなってしまったので、レポートの作成については端折ります。皆様のセンスで、自由にレポートを作成いただければと思います。

冒頭で埋め込んだサンプルコンテンツは こちら からダウンロード頂けますので、もしよろしければご活用ください。
 

[Power BI] DAX入門 (4) 動的なランキング計算 –RANKX 関数の活用-

$
0
0

この記事は、2016 年 8 月 24 日 に Data Platform Tech Sales Team Blog にて公開された内容です。

 

Microsoft Japan Data Platform Tech Sales Team

土井

DAX 入門 第 4 回目では、データ集計においてよく使われるランキング計算 (ランク関数) について触れていきます。

DAX では RANKX 関数や TOPN 関数を使ってランキング計算が可能になっています。今回は RANKX 関数について具体的な使用方法をご紹介していきます。

■サンプルデータのインポート

本記事では こちら の Excel ファイルをデータソースとして用います。(Power BI 自習書サンプルスクリプト として使用されている NorthWindJ データベースの一部となります。)

Power BI Desktop を起動して、上記の Excel ファイルを指定して商品テーブルと売上テーブルを取り込みます。

image

 

■メジャーの作成

モデリング メニューから、新しいメジャー をクリックします。

image

まず、売上金額を単純に集計するためのメジャー [売上計] を作成します。

売上計 = SUM('売上'[売上])

 

つぎに、売上が大きい順に商品ランキングをつけるために、メジャー [商品ランク] を作成します。RANKX の引数の詳細については リファレンス を参照ください。

商品ランク = RANKX(ALL('商品'),[売上計],,DESC)

 

これにより、下記のようなレポートをつくることができます。

image

 

■動的なランキング表示

たとえばさきほどのレポートで、商品区分名でフィルタリングをした場合、商品ランクは商品テーブル全体の中で何位か、を示します。

image

絞り込んだ商品区分の中でのランキングを表示したい場合、つまり、フィルター条件に基づいてランキング判定をしたい場合はさきほど作成したメジャーにおいて、 ALL 関数ではなく、 ALLSELECTED 関数を使用します。

商品ランク = RANKX(ALLSELECTED('商品'),[売上計],,DESC)

 

これにより、下記のようなレポートを作成できます。

image

 

フィルター機能を使って、下記のように トップ 10 など、任意の数字に絞り込むこともできます。

image

 

■まとめ

今回は RANKX 関数を使って、ランキング計算をする例を紹介いたしました。作成した Power BI Desktop ファイルは こちら からダウンロードできます。

ダウンロードいただいた、ranksample.pbit を開くと、下記プロンプトが表示されますので、冒頭でダウンロードした Excel ファイル が置いてあるフォルダパス (例えば、c:tmp など) を入力して読み込みボタンを押してください。

※フォルダパスの末尾に が必要なのでご注意ください

image
 

Top Contributors Awards! C# Processing CSV files and many more!

$
0
0

Welcome back for another analysis of contributions to TechNet Wiki over the last week.

First up, the weekly leader board snapshot...

As always, here are the results of another weekly crawl over the updated articles feed.

 

Ninja Award Most Revisions Award
Who has made the most individual revisions

 

#1 George Chrysovaladis Grammatikos with 100 revisions.

 

#2 S.Sengupta with 41 revisions.

 

#3 Dave Rendón with 23 revisions.

 

Just behind the winners but also worth a mention are:

 

#4 get2pallav with 21 revisions.

 

#5 Andrei Stoica with 19 revisions.

 

#6 Arleta Wanat with 18 revisions.

 

#7 Jayendran arumugam with 16 revisions.

 

#8 Peter Geelen with 14 revisions.

 

#9 Bruno Lopes (MVP) with 13 revisions.

 

#10 Richard Mueller with 11 revisions.

 

 

Ninja Award Most Articles Updated Award
Who has updated the most articles

 

#1 get2pallav with 16 articles.

 

#2 George Chrysovaladis Grammatikos with 13 articles.

 

#3 Arleta Wanat with 12 articles.

 

Just behind the winners but also worth a mention are:

 

#4 Peter Geelen with 8 articles.

 

#5 Dave Rendón with 8 articles.

 

#6 RajeeshMenoth with 7 articles.

 

#7 Bruno Lopes (MVP) with 7 articles.

 

#8 Somdip Dey - MSP Alumnus with 3 articles.

 

#9 Jayendran arumugam with 3 articles.

 

#10 Richard Mueller with 2 articles.

 

 

Ninja Award Most Updated Article Award
Largest amount of updated content in a single article

 

The article to have the most change this week was User Page: Kamlesh Kumar, by Kamlesh Koomar

This week's reviser was Kamlesh Koomar

 

 

Ninja Award Longest Article Award
Biggest article updated this week

 

This week's largest document to get some attention is C# Processing CSV files Part 1, by Kareninstructor

This week's revisers were get2pallav & Kareninstructor

 

 

Ninja Award Most Revised Article Award
Article with the most revisions in a week

 

This week's most fiddled with article is Windows 10:Your phone app, by S.Sengupta. It was revised 24 times last week.

This week's reviser was S.Sengupta

 

 

Ninja Award Most Popular Article Award
Collaboration is the name of the game!

 

The article to be updated by the most people this week is Azure: Daily Reports using Logic Apps, by Jayendran arumugam

This week's revisers were Jayendran arumugam, Dave Rendón & George Chrysovaladis Grammatikos

 

 

Ninja Award Ninja Edit Award
A ninja needs lightning fast reactions!

 

Below is a list of this week's fastest ninja edits. That's an edit to an article after another person

 

Ninja Award Winner Summary
Let's celebrate our winners!

 

Below are a few statistics on this week's award winners.

Most Revisions Award Winner
The reviser is the winner of this category.

George Chrysovaladis Grammatikos

George Chrysovaladis Grammatikos has won 26 previous Top Contributor Awards. Most recent five shown below:

George Chrysovaladis Grammatikos has not yet had any interviews, featured articles or TechNet Guru medals (see below)

George Chrysovaladis Grammatikos's profile page

Most Articles Award Winner
The reviser is the winner of this category.

get2pallav

get2pallav has won 5 previous Top Contributor Awards:

get2pallav has TechNet Guru medals, for the following articles:

get2pallav has not yet had any interviews or featured articles (see below)

get2pallav's profile page

Most Updated Article Award Winner
The author is the winner, as it is their article that has had the changes.

Kamlesh Koomar

[Kamlesh Kumar] has been interviewed on TechNet Wiki!

[Kamlesh Kumar] has won 32 previous Top Contributor Awards. Most recent five shown below:

[Kamlesh Kumar] has TechNet Guru medals, for the following articles:

[Kamlesh Kumar] has not yet had any featured articles (see below)

[Kamlesh Kumar]'s profile page

Longest Article Award Winner
The author is the winner, as it is their article that is so long!

Kareninstructor

Kareninstructor has been interviewed on TechNet Wiki!

Kareninstructor has won 11 previous Top Contributor Awards. Most recent five shown below:

Kareninstructor has TechNet Guru medals, for the following articles:

Kareninstructor has not yet had any featured articles (see below)

Kareninstructor's profile page

Most Revised Article Winner
The author is the winner, as it is their article that has ben changed the most

S.Sengupta

S.Sengupta has won 9 previous Top Contributor Awards. Most recent five shown below:

S.Sengupta has not yet had any interviews, featured articles or TechNet Guru medals (see below)

S.Sengupta's profile page

Most Popular Article Winner
The author is the winner, as it is their article that has had the most attention.

Jayendran arumugam

This is the first Top Contributors award for Jayendran arumugam on TechNet Wiki! Congratulations Jayendran arumugam!

Jayendran arumugam has not yet had any interviews, featured articles or TechNet Guru medals (see below)

Jayendran arumugam's profile page

Ninja Edit Award Winner
The author is the reviser, for it is their hand that is quickest!

George Chrysovaladis Grammatikos

George Chrysovaladis Grammatikos is mentioned above.

 

 Says: Another great week from all in our community! Thank you all for so much great literature for us to read this week!

Please keep reading and contributing, because Sharing is caring..!!

 

Best regards,

 

日本マイクロソフトの金融機関や公共機関に向けてのクラウド利用促進支援策【10/21 更新】

$
0
0

マイクロソフトでは、Azure を始めとして、Microsoft 365(Office 365)、Azure DevOps(旧 Visual Studio Team Service)、Dynamics 365 など広範なパブリッククラウドサービスを提供しており、これらは国際的および各国のセキュリティやコンプライアンス基準を満たしております。ISO 27001、ISO 27018、HIPAA、FedRAMP、SOC 1、SOC 2 などに加えて、クラウドセキュリティゴールドマークにも対応しており、金融機関をはじめ、高いセキュリティ基準が求められるお客様のニーズに対応しています。また、NISC(内閣サイバーセキュリティセンター)が定める統一基準に準拠し、日本でサービス提供しているパブリッククラウドベンダーとして、クラウド セキュリティ ゴールドマーク (CS ゴールドマーク)を初めて取得し、政府情報システムにおいても安心して導入・利用いただけるサービスとなっています。

 

 

関連項目

参考情報

 

 


Sigcheck 2.70, BgInfo v4.26, and VMMap v3.22

$
0
0

Sigcheck v2.70
Windows WinVerifyTrust function reports signed MSI files that have malware appended to them as signed, so Sigcheck now indicates when appended conent is present.

BgInfo v4.23
BgInfo now honors Application Guard scripting policy.

VMMap v3.22
This release of VMMap fixes bugs that excluded copy-on-write pages from the private bytes total and that double counted the contribution of page table entries (PTEs).

Sorry you don’t have enough privileges to post an article on the Wiki.

$
0
0

Introduction

For a very long time, already since the inception of your favorite Wiki, we have been facing quite some attention from spammers, posting the most ludicrous content.

In 2016-2017... while we even had a semi-professional spam hunter team (we still do), who ended up killing a few 100+ spam articles a day, which was more than we used to do in normal maintenance, causing a major stress on the TNWiki including performance and quality-dips ...

In November 2017, the technical platform team at Microsoft worked very hard to put a spam blocker solution in place, cutting down the spam stream to 0, from one day to another.

And since then we're virtually free of spam (with a few exceptions and a ton of spam history to kill...)… but the story does not end there.

See also

The post below is an extract/compilation of the forum threads and the FB discussions. So you might see some content being quoted, with permission of the most important contributor(s).

TN Forum post "Enough privileges to post an article on the Wiki"

And check the Wiki Ninja's Facebook group posts on the topic.

(This is a cross post from the TN Wiki, to increase searchability and to allow for updates in case of updates to Wiki policies and governance. )

Credits

Ronen Ariely (aka pituach), Richard Mueller

Collateral damage issue

Although the solution is built based on the typical behavior of spammers and works great overall, there is a small side effect to be noticed: in a very small number of cases legitimate Wiki publishers might not be able to create new articles.

When you hit this issue, you'll see a warning like "Sorry you don’t have enough privileges to post an article on the Wiki".

How it works

In essence, you must build sufficient reputation before you can post new articles on TNWiki.

The actual algorithm and requirements are more complicated, but are not disclosed for obvious reasons. As Richard already mentioned in one the forum threads "They were put in place recently to prevent spam Wiki articles. As such, we should not know the exact requirements. We don't want the spammers to have any clues to overcome the requirements."

Solution

There are a few methods to overcome the issue:

  1. Building a reputation on the MSDN/TN community
  2. Work together with an other community member on your first publications

Building reputation first

Reference: MSDN, TechNet and Expression Profile – FAQ: https://technet.microsoft.com/en-US/ff395928.aspx?#How_do_I_earn_points_

As explained by Ronen on the forum post: The first option is "you can help people here in MSDN and TechNet forums by answer questions and take part in discussions. Once you answer someone question you gain some points, once you write a useful message you can gain some points, and so on... You can join us at the Facebook group
and become part of the community in different activities, in a short time you should gain the points to be able to post articles directly :-)"

As explained in the FAQ, there are a few options to build reputation:

  • MSDN/TechNet Forums
  • TN/MSDN Gallery
  • TNWiki Edits

Forums (from FAQ)

Your forum post is confirmed as an answer by the original question asker. +15
Your forum post that was marked as an answer is removed by the original question asker. -15
Your forum post is confirmed as an answer by the original question asker in less than 8 hours. +20
Your forum post that was marked as an answer when contributed in less than 8 hours was removed by the original question asker. -20
Your forum post is confirmed as an answer by the community. +10
Your forum post that was marked as an answer is removed as an answer by the community. -10
Your forum post is confirmed as an answer by the community in less than 8 hours. +15
Your forum post that was marked as an answer when contributed in less than 8 hours was removed by the community. -15
You identified a helpful topic. +5
Your forum question thread has more than 5 votes in it. +5
Your forum question thread has more than 10 votes in it. +10
Your forum post receives a vote by the community. +5
Your forum question has a confirmed answer and has been viewed 20,000 times. +10
Your forum question has a confirmed answer and has been viewed 40,000 times. +15

Gallery (From FAQ)

Your gallery contribution was downloaded 20 times. +20
Your gallery contribution was downloaded 50 times. +50
Your gallery contribution was downloaded 100 times. +100
Your gallery contribution was downloaded 1,000 times. +500
Your gallery contribution was downloaded 10,000 times. +2000
Your gallery contribution was downloaded 100,000 times. +5000
Your gallery contribution receives a 5 star rating. +10
Your gallery contribution receives a 4 star rating. +5
Your gallery contribution receives a 3 star rating. +2

Wiki

Even when you're not able to post new articles on TNWiki, you can still edit them. And for significant and useful edits, you DO get points.

[A small warning should be set here: if you think to bypass the spam detection, you're wrong. A single spam edit, or destroying valid content is a major reason to be banned immediately. Plus the Wiki system offers a quick function to revert to the last valid version, so it's not worth even trying it. ;)]

As explained in the FAQ : "You are eligible to receive a portion of an available set of points, depending upon your edit quantity and the milestone reached."

The article you authored reached one out of 10 possible page view milestones. The various milestones range between 500 and 1 million page views. +5 to +2500
The article you edited reached one out of 10 possible page view milestones. The various milestones range between 500 and 1 million page views. You are eligible to receive a portion of an available set of points, depending upon your edit quantity and the milestone reached. +1 to +2500

Conclusion: you FIRST invest some time in the forums, the gallery, and then post the best of yourself on the TNWIKI.

Via Article sponsor

As editing an Wiki article (actually, combined with view count), is a way to build your reputation, that is exactly one of the methods to get started, except that you ask some help to create the initial entry.

Just to be clear, 'creating' an article does not count for points, and the fact of 'editing' itself neither.

As explained in the FAQ:

Wiki Create a New Wiki Article. 0
Edit a Wiki Article. 0
You contributed a comment on the Wiki. 0
You contributed a comment while editing an article on the Wiki. 0

So, it's not about the count of edits, it's not about the count for comments, it's not about the count of changing tags. That will bring 0 points.

What you DO get points for is: the significant AMOUNT of content you edit, in relation to the page views that the page gets.
So it's a pretty fair system to earn points.

In practice:

  1. Prepare your post (title, content, tags, … needed)
  2. Check if you can create a new article (to see if you have sufficient reputation yet to unlock the TNWiki)
  3. If not, ask a question to help you creating your wiki page, in the TNWiki forum of the TNWiki Facebook page
    1. TNWiki forum: http://aka.ms/WikiForum
    2. TNWiki FB page: https://www.facebook.com/groups/TechNetWikiNinjas
  4. Let the sponsor create an article with minimum content
  5. Fill the initial article with your content.

Please realise this is a temporary situation and once you unlocked the publication access, you're launched to create your own articles.

And last but not least, it's very important that you understand and comply to the TNWiki standards and guidelines when updating and publishing TNWiki articles. That's an essential task as TN Wiki Ninja.

What is expected from an author, I've explained it before in these posts:

In any case, if you need help, feel free to get in touch via the forum, the Facebook page or directly via other channels!

Kind regards,
Peter

[Power BI] DAX 入門 (5) 累計、年度をまたいだ累計

$
0
0

この記事は、2016 年 10 月 19 日 に Data Platform Tech Sales Team Blog にて公開された内容です。

 

Microsoft Japan Data Platform Tech Sales Team

土井

DAX 入門 第 5 回目では累計について説明していきます。

 

■年度累計、四半期累計、月度累計

DAX では非常に簡単に累計を求めることができます。まずあらかじめ用意されている累計関数として以下の関数があります。

TOTALYTD 関数 ・・・ 年度累計値を算出します

TOTALQTD 関数 ・・・ 四半期累計値を算出します

TOTALMTD 関数 ・・・ 月度累計値を算出します

 

では実際にサンプルデータで使い方を見ていきましょう。今回は 気象庁 で公開されている 台風のデータ を使います。

Web 上の情報を簡単に取り込むことができるのも Power BI の特徴です。今回はデータを取得するところは省略しますが、こちらこちら を参照していただければ、

下記赤枠部分でどんなステップを適用しているかがお分かりいただけるかと思います。サンプルは こちら からダウンロードしてお試しください。

image

 

上記の サンプル をダウンロードいただくと、下記のように カレンダーテーブル と 台風の発生数テーブル があることが確認できます。カレンダーテーブルの作成方法は 以前の記事 を参照ください。

image

 

では早速累計メジャーを作成していきます。”モデリング” メニューから “新しいメジャー” をクリックします。

image

 

image

ここでは以下の二つのメジャーを作成します。(今回のサンプルデータは月次データのため、月度累計 TOTALMTD は省略します)

年度累計 = TOTALYTD([発生数計],'カレンダー'[日付])
四半期累計 = TOTALQTD([発生数計],'カレンダー'[日付])

 

では、作成したメジャーが正しく計算されているか、レポートで確認してみましょう。レポート画面に移動し、下図のようにフィールドから “年月” 、”年度累計” を選択し、視覚化メニューから ”縦棒グラフ” を選択します。

image

同様に、四半期累計のグラフも作成します。

image

年度累計は 1 月 ~ 12 月の累計を、四半期累計は 1 月 ~ 3 月、4 月 ~ 6 月、・・・、という形で正しく累計を計算できていることがわかります。

 

なお、TOTALYTD 関数 のパラメータとして、<year_end_date> に任意の値を入力することで、会計年度での計算をすることもできます。

たとえば、日本のお客様で一般的な 4 月はじまりを想定すると、以下のような式となります。

会計年度累計 = TOTALYTD([発生数計],'カレンダー'[日付],”3/31”)

image

■年度をまたいだ累計

1 年間の累計でなく、複数年にまたがった累計を算出したい、というケースもあるかと思います。

この場合、いくつかやり方はありますが、今回は CALCULATE 関数FILTER 関数ALLSELECTED 関数 を使って計算します。

CALCULATE 関数 ・・・ 後続のパラメータによって指定されたフィルター条件によって計算結果を返します。

FILTER 関数 ・・・ あるテーブルを後続の条件でフィルタリングします。戻り値はテーブルです。

ALLSELECTED 関数 ・・・ スライサーや、フィルタで指定された条件を反映させた状態でテーブルを返します。

これらを使って、累計は以下のように定義できます。

 

累計 = CALCULATE([発生数計],FILTER(ALLSELECTED('カレンダー'),[日付]<=MAX([日付])))

 

さきほどと同じように、レポートで確認してみましょう

image

2015 年初から 2016 年末までの累計を計算できています。スライサーで期間を指定すれば動的に計算されます。

 

■まとめ

累計は標準の DAX 関数を使うことで簡単に定義ができます。また、特殊な要件があった場合でも少し工夫をすれば計算が可能なケースが多いです。

サンプルの完成形は こちら からダウンロードいただけます。

関連記事

 

[Power BI] DAX 入門 (6) DAX 行フィルターを使用した動的なセキュリティ [SSAS]

$
0
0

この記事は、2017 年 1 月 10 日 に Data Platform Tech Sales Team Blog にて公開された内容です。

 

Microsoft Japan Data Platform Tech Sales Team

川野 純

DAX 入門 第 6 回目では動的なセキュリティについて説明していきます。

先日、お客様から SQL Server Analysis Services ( 以下、SSAS ) 表形式のロール定義で Active Directory のグループをマップし、そのロールにおける固定値でフィルター条件を定義できるが、同じグループのメンバーごとにきめ細かくアクセス権を設定できないか、という相談を受けました。

確かに、Active Directory 上の組織と各データへのアクセス権限が一致している企業であれば固定値でフィルター条件を定義しても事足りますが、現実の組織では様々な事情により Active Directory の階層とは関係なく各データへのアクセス制御を行わなければならないケースが多々あります。

このような場合に便利なのが USERNAME 関数LOOKUPVALUE 関数 という 2 つの DAX 関数です。

これらを DAX 行フィルター式に適用する際に、Active Directory とは独立した「お客様の組織の独自ルールを定義したテーブルのデータ」と組み合わせることでも、分析データへの動的なアクセス制御を実現できます。

また、この方法は Power BI Desktop と Power BI サービスを組みわせた場合や、Power BI Desktop と Power BI サービス のバックエンドに オンプレミス データ ゲートウェイ経由で SSAS に接続する場合にも適用されます。今回はお話の発端が SSAS 表形式 (以下、簡略のために SSAS と表記) であったことから SSAS をベースにご説明します。

行フィルターを使用した動的なセキュリティの実装

SSAS のロールではユーザー/グループ マッピングと行フィルター条件を疎関係で柔軟に定義できる良さがあります。

上記のオンラインマニュアルで USERNAME 関数LOOKUPVALUE 関数 という 2 つの DAX 関数を使用した動的セキュリティの設定例が紹介されています。
しかし、若干?わかりづらいので、本記事ではポイントを絞って解説していきたいと思います。下図はこの設定例を簡単に図式化したものです。

DynamicSecurityOverview

ここでポイントになる部分は、ロールの上部に出ている吹き出しに記述されている DAX 式です。この DAX 式で動的な行フィルターを実現しています。

ではこの DAX 式を見ていきましょう。

1 FILTER (
2     'Sales Territory',
3     'Sales Territory'[Sales Territory Id]
4         = LOOKUPVALUE (
5             'Employee Security'[Sales Territory Id],
6             'Employee Security'[Login Id], USERNAME (),
7             'Employee Security'[Sales Territory Id], 'Sales Territory'[Sales Territory Id]
8         )
9 )

最初は難しいかもしれませんが、一つ一つ紐解いていきましょう。

使用されている関数の意味を理解し、DAX 式を読み解こう

最初に出てきている FILTER 関数が何をしているのか理解しておく必要があります。
ざっくり言うと、table パラメーター ( DAX 式 2 行目 ) はフィルターする対象のテーブルで、filter パラメーター ( DAX 式 3 ~ 8 行目 ) はフィルタリング条件です。

’Sales Territory’ テーブルから、filter パラメーターに指定した条件で抜き出したデータをテーブル形式で返してね、と記述しています。

FILTER 関数

別のテーブルまたは式のサブセットを表すテーブルを返します。

構文

FILTER(<table>,<filter>)

パラメーター

table

フィルターを適用するテーブル。 このテーブルは、結果としてテーブルが得られる式として指定することもできます。

filter

テーブルの行ごとに評価するブール式。 たとえば、[Amount] > 0 または [Region] = "France" のようになります。

戻り値

フィルター選択された行のみが含まれているテーブル。

次に、FILTER 関数の filter パラメーターの中で登場してきているのが、少々ややこしい LOOKUPVALUE 関数です。

result_columnName パラメーターは戻り値として返してほしい列を指定します。DAX 式では ’テーブル名’[列名] 形式で表現される点に注意してください。
SQL 言語の SELECT 文における SELECT リストに含める列名と、FROM 句に指定する表名を同時に指定しているようなイメージです。

search_columnName パラメーターおよび search_value パラメーターはペアで指定します。
SQL 言語の SELECT 文における WHERE 句に指定する等価条件のようなイメージです。このペアは複数指定できますが、AND 条件で結ばれる点に注意が必要です。

'Sales Territory'[Sales Territory Id] ( DAX 式 3 行目 ) と等価条件で一致するデータを LOOKUPVALUE 関数で抽出しています。
抽出するのは 'Employee Security' テーブルの [Sales Territory Id] 列の値です。( DAX 式 5 行目 )

LOOKUPVALUE 関数 (DAX)

search_columnName および search_value によって指定されたすべての条件を満たす行の result_columnName 内の値を返します。

構文

LOOKUPVALUE(

<result_columnName>,

<search_columnName>, <search_value>

[, <search_columnName>, <search_value>]…

)

パラメーター

result_columnName

取得する値が含まれている既存の列の名前。

標準 DAX 構文を使用して名前を指定する必要があります (通常は完全修飾名)。

式を指定することはできません。

search_columnName

参照の対象となる、result_columnName と同じテーブル内または関連テーブル内の既存の列の名前。

標準 DAX 構文を使用して名前を指定する必要があります (通常は完全修飾名)。

式を指定することはできません。

search_value

検索対象の同じテーブル内のどの列も参照しないスカラー式。

戻り値

search_column および search_value のすべてのペアが一致する行の result_column の値。

検索値のすべてを満たす一致がない場合は、空白が返されます。

つまり、条件の一部しか一致しない場合、関数は参照値を返しません。

複数の行が検索値と一致し、すべてのケースで result_column 値が等しい場合は、その値が返されます。

ただし、result_column から異なる値が返される場合は、エラーが返されます。

そして、'Employee Security' テーブルの [Login Id] 列の値と USERNAME () の戻り値が一致するもの、というのが一つ目の検索条件です。( DAX 式 6 行目 )
ここで使用されている USERNAME 関数は「ドメイン名ユーザー名」を返す、シンプルで分かりやすい関数です。

USERNAME 関数

接続時にシステムに指定された資格情報のドメイン名とユーザー名を返します。

構文

USERNAME()

戻り値

接続時にシステムに指定された資格情報のユーザー名

最後に 'Employee Security' テーブルの [Sales Territory Id] 列の値のうち、'Sales Territory' テーブルの [Sales Territory Id] 列に存在するもの、というのが二つ目の検索条件です。( DAX 式 7 行目)

説明が長くなりましたが、下図は動的行フィルターで定義している内容をテーブルのイメージとともに図式化してまとめたものです。
ご理解の一助になればと思います。

DynamicRowFilterDefinition

補足情報1:ロール マネージャー のダイアログボックスで指定しているもの

ところで、SQL Server Data Tools ( 以下、SSDT ) でロールを定義する際に使用するロール マネージャーのダイアログボックスにおいて、行フィルター タブでは何をしているか?
ここまで読み進めてくればもうお判りだと思います。

テーブル 列 = FILTER 関数の table パラメーター
DAX フィルター 列 =FILTER 関数の filter パラメーター

ということで FILTER 関数の引数を指定しています。

RoleManager

 

補足情報2:FILTER 関数の filter パラメーターを複合条件にするには

&& 演算子や || 演算子も使えますし、AND 関数や OR 関数を使用する方法もあります。

FILTER(<table>, (<filter1>) && (<filter2>))
FILTER(<table>, AND((<filter1>), (<filter2>)))
FILTER(<table>, (<filter1>) || (<filter2>))
FILTER(<table>, OR((<filter1>), (<filter2>)))

DAX 演算子リファレンス
AND 関数
OR 関数

補足情報3:DaxStudio と SSDT の使い分け

DAX 式のテストは DaxStudio が便利です。とはいえ、SSDT にもいいところはあります。

DaxStudio

あくまで私見ですが、それぞれのツールには以下のような特徴があると感じています( DAX に絞った話です )。

SSDT でのテスト

・ユーザーを指定したロールテストは便利
・複数ロールを組合せたテストは便利
・DAX 式を小さいボックスに IntelliSense なしで記述して、動作確認するのに毎回 Excel を起動するのはちょっと...

DaxStudio でのテスト

・実際に SSAS に接続しており、DAX 式を記述する際に IntelliSense が動作するので生産性が高い
・記述した DAX 式の整形 ( Format Query ) したり、実行 ( Run ) ボタンですぐに結果を確認できるところがとても良い

最後に

DAX は少々とっつきにくいところはありますが、使いこなすと非常に強力な言語です。
この記事をきっかけに興味を持たれた方は以下の連載記事もぜひご覧ください。

関連記事

関連リンク

 

2018 年 9 月に発生していた WSUS –弊社サイト間の一時的な同期障害について

$
0
0

皆さま、こんにちは。WSUS サポートチームです。

2018 年 9 月に WSUS と弊社 Microsoft Update サイト間において、一時的に同期が失敗する事象が発生しておりましたので、本記事にてご報告いたします。

本事象については、弊社 Microsoft Update サイトの更新に伴う問題があったことに起因しておりました。そのため、事象発生直後より、開発部門にて調査、対応を行い、根本要因を特定の上、9 月中に全ての問題について対策を実施いたしました。そのため、本問題は既に解消しており、現在は発生いたしません。

この度は弊社サイトの問題により、ご迷惑をおかけいたしましたことを、深くお詫び申し上げます。

なお、現時点で本問題は解消しているため、WSUS 側で対応を実施していただく必要はございません。

また、今回の問題を受けて、既に弊社内にて弊社サイトの変更時のプロセスの見直しを行っております。
今後とも継続的改善を実施し、サービスの安定と充実を目指して更なる品質の向上に努めて参りますので、何とぞご理解賜りたくお願い申し上げます。

Viewing all 34890 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>