Power BI 임베디드 분석의 질문 및 답변

Power BI 임베디드 분석은 Q&A를 애플리케이션에 통합하는 방법을 제공합니다. 사용자는 자연어를 사용하여 질문을 할 수 있으며 차트나 그래프와 같은 시각적 개체로 즉시 답변을 받을 수 있습니다.

Animated GIF of the Power BI Embedded view, which shows how to embed a sample Q&A question.

애플리케이션 내에 Q&A를 포함하기 위한 두 가지 모드인 대화형결과만 있습니다. 대화형 모드에서는 질문을 입력하고 시각적 개체 내에 표시할 수 있습니다. 저장된 질문이 있거나 표시하려는 질문이 있으면 embed config에 질문을 채워서 결과 전용 모드를 사용할 수 있습니다.

다음은 JavaScript 코드의 예입니다.

// Embed configuration used to describe the what and how to embed.
// This object is used when calling powerbi.embed within the JavaScript API.
// You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details.
var config= {
    type: 'qna',
    tokenType:   models.TokenType.Embed | models.TokenType.Aad,
    accessToken: access token value,
    embedUrl:    https://app.powerbi.com/qnaEmbed (groupId to be appended as query parameter if required),
    datasetIds:  array of requested data set ids (at the moment we support only one dataset),
    viewMode:    models.QnaMode.Interactive | models.QnaMode.ResultOnly,
    question:    optional parameter for Explore mode (QnaMode.Interactive) and mandatory for Render Result mode (QnaMode.ResultOnly)
};

// Get a reference to the embedded QNA HTML element
var qnaContainer = $('#qnaContainer')[0];

// Embed the QNA and display it within the div container.
var qna = powerbi.embed(qnaContainer, config);

설정 질문

설정 질문으로 결과 모드를 사용하는 경우 프레임에 더 많은 질문을 주입할 수 있습니다. 새 질문에 대한 답변은 이전 결과를 즉시 대체합니다. 새 질문과 일치하는 새 시각적 개체가 렌더링됩니다.

이런 사용의 한 가지 예는 질문과 답변 목록입니다. 사용자가 질문을 검토하고 포함된 동일한 부분 내에 답변을 할 수 있습니다.

JS SDK 사용을 위한 코드 조각:

// Get a reference to the embedded Q&A HTML element
var qnaContainer = $('#qnaContainer')[0];

// Get a reference to the embedded Q&A.
qna = powerbi.get(qnaContainer);

qna.setQuestion("This year sales")
    .then(function (result) {
        …….
    })
    .catch(function (errors) {
        …….
    });

시각적 개체가 렌더링된 이벤트

대화형 모드의 경우 렌더링된 시각적 개체가 변경될 때마다 업데이트된 입력 쿼리를 대상으로 데이터가 변경된 이벤트를 사용하여 애플리케이션에 통지할 수 있습니다.

visualRendered 이벤트를 수신 대기하면 나중에 사용할 수 있도록 질문을 저장할 수 있습니다.

JS SDK 사용을 위한 코드 조각:

// Get a reference to the embedded Q&A HTML element
var qnaContainer = $('#qnaContainer')[0];

// Get a reference to the embedded Q&A.
qna = powerbi.get(qnaContainer);

// qna.off removes a given event listener if it exists.
qna.off("visualRendered");

// qna.on will add an event listener.
qna.on("visualRendered", function(event) {
     …….
});

embed 토큰

의미 체계 모델에서 포함 토큰을 만들어 Q&A 파트를 시작합니다. 자세한 내용은 토큰 생성 작업을 참조하세요.

JavaScript 포함 샘플로 Q&A 포함 시도

추가 질문이 있으신가요? Power BI 커뮤니티에 문의