Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
Hi I have a sample scenerio data set(actual data set used has thousands of rows):
Location | Date | Item | % of total of the day |
East | 1/1/2012 | Burger | 80 |
West | 1/1/2012 | Burger | 40 |
North | 1/1/2012 | Burger | 30 |
East | 1/1/2012 | Fries | 20 |
West | 1/1/2012 | Fries | 60 |
North | 1/1/2012 | Fries | 70 |
East | 2/1/2012 | Burger | 40 |
West | 2/1/2012 | Burger | 50 |
North | 2/1/2012 | Burger | 30 |
East | 2/1/2012 | Fries | 60 |
West | 2/1/2012 | Fries | 50 |
North | 2/1/2012 | Fries | 70 |
Latest Date | 2/1/2012 |
% of the total of the day | 40 |
Date of Max % of the total of the day | 1/1/2012 |
Max % of the total of the day | 80 |
Solved! Go to Solution.
Hi sorry for the late reply, the solution presented has helped solved part of this proble. I found a simpler solution butit is not completed.
measure for Max % of the total of the day:
Max % of the total of the day = CALCULATE(MAX('data'[% of total of the day]),ALLEXCEPT('data','data'[location],'data'[item]))
measure for Date of Max % of the total of the day:
Date of Max % of the total of the day =LOOKUPVALUE('data'[Date],'data'[% of total of the day],[Max % of total of the day])
measure for latest date:
Latest Date = CALCULATE(LASTDATE('data'[date]),ALLEXCEPT('data','data'[item],'data'[location]))
But for the corresponding value which is % of the total of the day, i thought I could use the same measure(lookupvalue) as Date of Max % of the total of the day, but it gave me an error, this was the DAX I used:
% of the total of the day for latest date = LOOKUPVALUE('data'[% of the total of the day],'data'[date],[Latest Date])
So I'm now focusing on solving this last problem, I started a new thread focusing more on it with more information of the scenerio:, link is below:
Last value of a calculated column based on slicer options.
This would do the trick:
___IsHighestOftheDay = var _tblSum = SUMMARIZE('Table','Table'[Date]//,'Table'[Item],'Table'[Location]
,'Table'[% of total of the day], "H", CALCULATE(MAX([% of total of the day]), ALLEXCEPT('Table',//'Table'[Location],
'Table'[Date])))
return
COUNTROWS(FILTER(_tblSum,[% of total of the day]=[H]))
__LatestDate = CALCULATE(MAX([Date]),ALLEXCEPT('Table','Table'[Location],'Table'[Item]))
___LatestDateWithHighestPosition = CALCULATE(MAX([Date]), FILTER(ALLEXCEPT('Table','Table'[Location],'Table'[Item]),[___IsHighestOftheDay]=1))
___LatestPercValithHighestPosition = CALCULATE(MAX([% of total of the day]), FILTER(ALLEXCEPT('Table','Table'[Location],'Table'[Item]),[___IsHighestOftheDay]=1))
___LatestDateWithHighestPosition = CALCULATE(MAX([Date]), FILTER(ALLEXCEPT('Table','Table'[Location],'Table'[Item]),[___IsHighestOftheDay]=1))
As seen here:
File is available here.
pls mark as solution if so. Thumbs up for the effort is appreciated.
Kind regards,
Steve.
Proud to be a Super User!
Awesome Keyboard Shortcusts in Power BI, thumbs up if you like the article
My Community Blog Articles (check them out!)
My Blog - Power M code to automatically detect column types -
How to create test data using DAX!
Hi , thank you for the reply, but I don't think this is the outcome I would want. To make it clearer, let me re explain,
Latest Date | 2/1/2012 |
% of the total of the day | 40 |
Date of Max % of the total of the day | 1/1/2012 |
Max % of the total of the day | 80 |
I would like to be able to select the menu and the location, and see when was the latest date that menu item was sold and how much % was it sold on that day. And in addition, also be able to see in the past history the date which had that menu item having the highest % of the day amoung all the other dates, so i can know whats the highest % I've ever sold on a day for that item and at that location.
Burger and fries are a simplified version of the actual data, the actual data has thousand of rows with years of data, each day there are like 20 items. And every day the items change. Hope this clarifies.
@Anonymous , I was a bit to quick with my initial response. I updated my response, pls take a look and see if this works for you.
Kind regards, Steve.
Proud to be a Super User!
Awesome Keyboard Shortcusts in Power BI, thumbs up if you like the article
My Community Blog Articles (check them out!)
My Blog - Power M code to automatically detect column types -
How to create test data using DAX!
Hi sorry for the late reply, the solution presented has helped solved part of this proble. I found a simpler solution butit is not completed.
measure for Max % of the total of the day:
Max % of the total of the day = CALCULATE(MAX('data'[% of total of the day]),ALLEXCEPT('data','data'[location],'data'[item]))
measure for Date of Max % of the total of the day:
Date of Max % of the total of the day =LOOKUPVALUE('data'[Date],'data'[% of total of the day],[Max % of total of the day])
measure for latest date:
Latest Date = CALCULATE(LASTDATE('data'[date]),ALLEXCEPT('data','data'[item],'data'[location]))
But for the corresponding value which is % of the total of the day, i thought I could use the same measure(lookupvalue) as Date of Max % of the total of the day, but it gave me an error, this was the DAX I used:
% of the total of the day for latest date = LOOKUPVALUE('data'[% of the total of the day],'data'[date],[Latest Date])
So I'm now focusing on solving this last problem, I started a new thread focusing more on it with more information of the scenerio:, link is below:
Last value of a calculated column based on slicer options.
User | Count |
---|---|
12 | |
12 | |
8 | |
8 | |
6 |
User | Count |
---|---|
27 | |
19 | |
13 | |
11 | |
7 |