In Power BI How do I turn off aggregation for decimal numbers on a stacked bar chart? - decimal

I have 2 columns of Decimal numbers where I want to report the actual value of the number, not the SUM, not the COUNT, the actual value. Wen I drop the Summarization selection list, Count is selected and I am unable to de-select it - clicking on it just leaves the selection checked and closes the list. Show Value As is set to No Calculation.
I have verified that the data type is Decimal, formatted to 2 decimal places. Default Summarization level is set to Do Not Summarize.
When I add one or both columns to the Visualization Pane they default to Count of .
The two columns are the result of Summarization. Essentially a total expressed as Percent Complete and Percent Reworked.
ByPerByState =
SUMMARIZE (
'periodResults',
periodResults[period],
periodResults[workFlow State],
"Period Complete", SUM ( 'periodResults'[Completed] ),
"Period Reworked", SUM ( 'periodResults'[Reworked] ),
"Total", SUM ( 'periodResults'[Completed] ) + SUM ( 'periodResults'[Reworked] ),
"PercentComplete", DIVIDE (
SUM ( 'periodResults'[Completed] ),
( SUM ( 'periodResults'[Completed] ) + SUM ( 'periodResults'[Reworked] ) ),
0
),
"Percent Reworked", DIVIDE (
SUM ( 'periodResults'[Reworked] ),
( SUM ( 'periodResults'[Completed] ) + SUM ( 'periodResults'[Reworked] ) ),
0
)
)

Related

how to translate Sum product formula in power bi

I have this data table, where i want to calculate the final score based on CI value my excel formula is =SUMPRODUCT(--(H4:H20>0),H4:H20,E4:E20)/SUMIF(H4:H20,">0",E4:E20)
The formula you are looking for is
final score =
DIVIDE(
SUMX(
'Table',
'Table'[CI] * 'Table'[score]
),
CALCULATE(
SUM('Table'[CI]),
'Table'[score] > 0
)
)
You can test this:
Your_Measure =
ROUND (
DIVIDE (
SUMX ( SumProduct, IF ( SumProduct[score] > 0, [score] * [CI] ) ),
SUMX ( SumProduct, IF ( [score] > 0, [CI] ) )
),
6
)
Result It produces :

Power Pivot Divide by 0 Percent Calculation Error in Excel

Good day to everyone, I am having a problem where I am creating a measure in Power Pivot Excel where the goal is to create a Accuracy Percentage based upon the division of 2 columns. Please see the attached picture below.
As you can see, dividing by 0 gives a 100 percent accuracy when it reality it should be blank and or not counted. The formula i am using for this percentage calculation is listed below.
=
IF (
ISBLANK (
1 - DIVIDE (
( DISTINCTCOUNT ( '03a Qry for Inaccurate Count'[KEY] ) ),
( DISTINCTCOUNT ( Std_MainData[KEY] ) )
)
),
0,
1 - DIVIDE (
( DISTINCTCOUNT ( '03a Qry for Inaccurate Count'[KEY] ) ),
( DISTINCTCOUNT ( Std_MainData[KEY] ) )
)
)
Please let me know if this is possible to fix, thanks.

How I can find percentage out of subtotals with multiple columns in Pivot table

How I can find percentage out of subtotals with multiple columns in Pivot table.
PercentYes :=
CALCULATE ( SUM ( MyTable[value] ), MyTable[answers] = "yes" ) /
CALCULATE (
SUM ( MyTable[value] ),
ALL ( MyTable[subcategory], MyTable[answers] )
)
I created a sample of values
I would first create a sum measure:
Sum of Values:=SUM(MyTable[Value])
Then, I would create the percentage measure:
Percent of Values :=
DIVIDE (
[Sum of Values],
CALCULATE (
[Sum of Values],
ALL ( MyTable[Subcategory],MyTable[Answers] )
)
)
Using DIVIDE will help with error trapping zeroes in the denominator. The result looks like this:

How to display blanks after 100% is reached? DAX measure

I have created a measure which calculates the percent of completion for each project. But my client wants it to display blanks after the project is completed, i.e. after the first 100%.
I already tried using an If function, but it is returning the same value for every month. I also looked online, but did not find a solution. Here is my %OfCompletion measure and the measure that it depends on.
% of Completion:=
VAR sproject =
IF ( HASONEVALUE ( Project[Project] ), VALUES ( Project[Project] ) )
RETURN
CALCULATE (
DIVIDE (
[S Expenses Running Total],
CALCULATE (
[Total Sales Costs] + [Total Sales Hours],
ALL ( Sales ),
Sales[Project] = sproject
)
),
Project[Classification] = "IN"
)
Expenses Running Total:= CALCULATE (
[Total Sales Costs] + [Total Sales Hours],
FILTER (
ALL ( Dates ),
Dates[Current Month Offset] <= MAX ( Dates[Current Month Offset] )
)
)
Example Values,
And a screenshot of my model.
This checks if current month completion is 100% AND prior month completion is also 100%, and returns BLANK - otherwise returns the actual completion value:
Monthly Completion Measure:=
IF (
[% of Completion] = 1 &&
CALCULATE (
[% of Completion],
PARALLELPERIOD (
Dates[Date],
-1,
MONTH
)
) = 1,
BLANK,
[% of Completion]
)

how to get a year history of data in dax

IIF(SUM
(
[Calendar].[Month].CurrentMember.Lag(11) :
[Calendar].[Month].CurrentMember,
[Measures].[Qty]
) = 0, 0,
SUM
(
[Calendar].[Month].CurrentMember.Lag(11) :
[Calendar].[Month].CurrentMember,
[Measures].[Num]
) /
SUM
(
[Calendar].[Month].CurrentMember.Lag(11) :
[Calendar].[Month].CurrentMember,
[Measures].[Qty]
) )
This is formula from multi dimensional model i am trying to convert this MDX formula to DAX formula to use in Tubular model.
12 Month Avg :=
IF (
CALCULATE (
SUM ( [QTY] ),
FILTER (
ALL ( Calendar[Month] ),
Calendar[Month] - 11
= ( Calendar[Month] - 11 )
)
)
= 0,
BLANK (),
CALCULATE (
SUM ( [Num] ),
FILTER (
ALL ( Calendar[Month] ),
Calendar[Month] - 11
= ( Calendar[Month] - 11 )
)
)
/ CALCULATE (
SUM ( [QTY] ),
FILTER (
ALL ( Calendar[Month] ),
Calendar[Month] - 11
= ( Calendar[Month] - 11 )
)
)
)
So i made this DAX formula to convert MDX formula at the top. However it seem not working properly when i select month in pivot table. Those two formula don't match when i filtered by month. How can i resolve that problem?
1) Create three base measures:
TotalNum := SUM([Num])
TotalQty := SUM([Qty])
Avg := DIVIDE ( [TotalNum], [TotalQty], 0 )
2) Create a calculated measure to calculate the average over the prior year including the current selected month:
AvgLastYear:= CALCULATE (
[Avg] ,
DATESINPERIOD (
Calendar[Date] ,
MAX(Calendar[Date]),
-1, year
)
)
Explanation:
First, you don't need that divide by zero rigmarole, both MDX and DAX have a DIVIDE() function which handles that implicitly.
Second, with DAX, the idea is to build a base measure and then use CALCULATE() to shift the context of that measure as needed - in this case the time period.
Here we're looking at the current selected month (represented as MAX(Calendar[Date]), though you could use any aggregation function) and then using DATESINPERIOD() to choose a set of dates in our Calendar table which represent the time period T-1 year to the current month.

Resources