DAX to Calculate Revenue using max and min - powerbi

Hey Experts,
Need to find out the revenue but facing an issue.
The actual billing should be the lesser values of the Attendance Count column and Max Billable Attendance count.
Based upon the actual billing, Need to calculate revenue. (Actual billing × 8.5 × 9.15)
Problem is that the TOTAL actual billing is not the aggregate of the individual actual billing. It is rather lesser of the two values in previous columns.

Related

PowerBI Filter or Sum based on Calendar Slicers

We run a hotel business. The structure of my fact table is arranged as a P&L report. Every month has a row for specific line items.
There's Month/QTD/YTD/L12M period slicers.
I've added columns for the total number of rooms sold and travelers per month in order to use them as references for writing Measures. This number stays constant throughout the month.
I want to build unit analytics into the dashboard. For example, the cost of linens per traveler per month. If I choose QTD, I want to add up the linen cost this quarter and divide by # of travelers this quarter.
To do this, I first created a Travelers Measure to start. The issue I'm running into is how to make it react to the period slicers.
If I try to use:
Travelers = SUM it adds up all the travelers or rooms sold even if it's within the same month (ie. in January - if I have 10 line items for the report and there were 10 total travelers, then it would show 100 travelers)
Travelers = MIN displays the correct number based on the selected month slicer, but fails to SUM the travelers based on the period slicer chosen. (eg. if I had 30 travelers QTD, it would still only show the number from the chosen month).
I'm no longer sure whether this is a DAX issue or if I should arrange my data differently.
Thank you!
Link: https://www.dropbox.com/s/5wl4dc5f560cswv/TestReport.pbix?dl=0

Power BI: Categorize customers based on measures

I have a list of customers that I wish to categorize based on two criteria: Share of total income and average time from due date to payment date.
I have a table with customer transactions that I can use to calculate these two criteria.
The solution I currently have is to use calculated columns in the customer table:
Sum of invoiced amount per customer/Total sum all customers = Share of total income
Average number of days per customer
I then use IF-functions to categorize these metrics into Big/Medium/Small customers, and Good/Medium/Bad payers.
Next I use a Matrix visualization to see number of customers for each category (Big customer/Good payer, Small Customer/Medium payer, and so on).
The problem I get is that the outcome of this is static, and they doesn't change if I use slicers to get only transactions from one year, or for only one of our companies.
Can I instead use measures for this, and get a dynamic Matrix visualization?
You need to use measures for this. It is a common pattern known as dynamic segmentation. You can read how to implement it here: https://www.daxpatterns.com/dynamic-segmentation/

Creating a measure for specific requirement in Power Bi

I am facing this below issue.
I need to calculate Budget variance % which is ((Actual Cost -Budget)/Budget)*100. So for that we need to sum the actual cost for a particular month say, January,2021 and have to subtract budget for that particular month(Jan) only, for each costcenter , and we have got only single budget for every month for each cost center whereas we have actual cost for each day in a month ,for each cost center ,which will be summed up. Actual cost and budget are coming from 2 diff tables say A & B respectively. Table A is having columns named Cost center,Date,ActualCost,OrderID. Table B consists of columns named, Cost center,Date,Budget. Date column is having diff set of dates in two diff tables A & B. So, when I am trying to do the required calculation, its throwing error . Can anyone please help me with the steps to follow to calculate this Budget variance?

HASONEFILTER SUMX total not calculating correctly

I am creating a Power BI measure that sums up averages so I have used the HASONEVALUE SUMX method but the total doesn't match what the actual sum would be if you just add up the information. Here is the measure:
And here is the results:
The total shows 31,654.25 but if you add up the rows you actually get 22,962.33. I am wondering if there is something wrong with my measure or if it is an issue of me not realizing it is pulling in additional information I'm not aware of.
This is calculating the average over all of the selected contracts and then summing that same value for each selected contract. (When you define a variable, it's treated as a constant in the remainder of the measure definition.)
Adding to #Alexis Olson, the average in a row is for the group, the total count is for entire datatable.
Below table is grouped by column A. Sum of averages is not equal to total average

Marketing penetration in OLAP cube - Help with specific MDX measure definition

I am pretty new to MDX but I know what I want accomplish but its proving very hard. Basically, I have a dataset where each row is a sale for a customer. I also have postcode data and the UK population at each ward.
The total population in each ward is then divided by the count of the wardcode within the data set - e.g. ward A had a population of 1,000. I have ten customers who live in ward A and so the population value is therefore 1,000/10.
So as long as there are no other dimensions selected, only the region hierarchy, I can then drill up and down and the population penetration as count of customers / calculated population value is correct. However, as soon as I introduce more dimension the total population will not sum to its true value.
So I therefore need to do the calculation above within the cube and I am trying to find the MDX function(s) to do this.
Esentially something like -
step 1) sum the number of ward codes (the lowest level of the Geographic hierarchy) and group this by the distinct ward code, eg wardcodeA = 5, wardcodeB=10 etc.
Step 2) Then take the population in each ward (which could be stored as the total at ward level and taking the average) and then divide this by the result of the previous step
step 3) sum the results from each ward at the currently select Geographical level
The fact other dimensions are changing the value of customers / population means that something in your modeling is wrong.
You should have a fact table (can be a view/concept) like this :
REGION_ID, CUSTOMER_COUNT, POPULATION_COUNT
Once you got this create a fact table and a specific measure for counting customers and population with a single dimension linked. This is the main point, do not link your measures with dimension that are not needed.