Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
926 views
in Technique[技术] by (71.8m points)

powerbi - Power Bi Calculate Growth Over Last Month and Show it in a Matrix

I have a below matrix. I want to calculate the % Growth over month and to show in a matrix

Sample Screenshot of Matrix visual

Fields

Fields used in Maatrix

Expected Output

Company August September GOLM % Total
EBS-EASEBUSINESS SOLUTIONS 5940 0 -100% 5940
? ? SWEETREAT CAFE 5940 0 -100% 5940
? ? ? ? M/S SPORTS ONE PHARMACY 1188 -100% 1188
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Maybe you can do something like this;

First create a DAX table by using modelling pane;

Growth = 
VAR CurrentMonth = FORMAT(TODAY(), "MMMM")
VAR PrevMonth =  FORMAT(EOMONTH(TODAY(),-1), "MMMM")
VAR tmp1 = SELECTCOLUMNS('Source Data',
                "SV_PrevMonth", CALCULATE(
                                    SUM('Source Data'[SALES VALUE]), 
                                    'Source Data'[Month Updates]=PrevMonth), 
                "SV_CurrentMonth", CALCULATE(
                                    SUM('Source Data'[SALES VALUE]), 
                                    'Source Data'[Month Updates]=CurrentMonth), 
                "PN", 'Source Data'[ProductNameFull],
                "CN", 'Source Data'[CustomerNameFull],
                "CP", 'Source Data'[Company]
            )  
return tmp1

Then add a measure to your table

GrowthPercentage = CALCULATE(DIVIDE(SUM(Growth[SV_CurrentMonth]) - SUM(Growth[SV_PrevMonth]), SUM(Growth[SV_PrevMonth]),0))*100

The result wil be like;

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...