Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I have measures that calculate the performance of a supplier base on the time period selected by user. In this example below this is the score for 2022. Is there anyway i can graph this measure over a period of time? i.e. show the performance in 2019, 2020, 2021, 2022, etc.
Solved! Go to Solution.
Hi @spardadt ,
I add some data:
Here are the steps you can follow:
1. Create calculated table.
Date =
CALENDAR(MIN('SupplierPerformance'[Receive Date]),MAX('SupplierPerformance'[Receive Date]))
2. Create measure.
# of NCMR 111 =
var _Ven=SELECTEDVALUE('SupplierPerformance'[Vendor ID])
return
COUNTX(FILTER(ALL(NCMR),'NCMR'[Vendor ID]=_Ven),[Vendor ID])
OTD %_1111 =
var _year=SELECTEDVALUE('Date'[Date].[Year])
var _Ven=SELECTEDVALUE('SupplierPerformance'[Vendor ID])
var _count1=COUNTROWS(FILTER(ALL(SupplierPerformance),'SupplierPerformance'[Vendor ID]=_Ven&&YEAR('SupplierPerformance'[Receive Date])=_year&&'SupplierPerformance'[Status]="On Time"))
var _count2=COUNTROWS(FILTER(ALL(SupplierPerformance),'SupplierPerformance'[Vendor ID]=_Ven&&YEAR('SupplierPerformance'[Receive Date])=_year))
return
DIVIDE(_count1,_count2)
3. Result:
The date of the slicer and the date of the line chart are used in the Date table [Date]
Put [OTD %_1111] to Secondary values
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi @spardadt ,
The first Measure[of NCMR 111] means,
First, use Var to define a slicer with the [Vendor ID] field. When a value is selected, Count the selected value.
The second measure[OTD %_1111] uses Var to define two slicers, one for [Date] Year, and the other for [Vendor ID]
_count1 means:
Count the number of rows in the SupplierPerformance table when the following conditions are met,
[Vendor ID] = [Vendor ID] value selected by slicer in table,
YEAR('SupplierPerformance'[Receive Date]) is the year to obtain [Receive Date]), the year of [Receive Date] in the table = 'Date'[Date].[Year] The value selected by the slicer
[Status]="On Time" in the table
_count2 has the same meaning as _count1, that is, there is one less condition of [Status]="On Time"
This is the function link used in the formula, I hope it will help you:
VAR keyword (DAX) - DAX | Microsoft Docs
SELECTEDVALUE function - DAX | Microsoft Docs
COUNTX function (DAX) - DAX | Microsoft Docs
COUNTROWS function (DAX) - DAX | Microsoft Docs
YEAR function (DAX) - DAX | Microsoft Docs
DIVIDE function (DAX) - DAX | Microsoft Docs
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @spardadt ,
I add some data:
Here are the steps you can follow:
1. Create calculated table.
Date =
CALENDAR(MIN('SupplierPerformance'[Receive Date]),MAX('SupplierPerformance'[Receive Date]))
2. Create measure.
# of NCMR 111 =
var _Ven=SELECTEDVALUE('SupplierPerformance'[Vendor ID])
return
COUNTX(FILTER(ALL(NCMR),'NCMR'[Vendor ID]=_Ven),[Vendor ID])
OTD %_1111 =
var _year=SELECTEDVALUE('Date'[Date].[Year])
var _Ven=SELECTEDVALUE('SupplierPerformance'[Vendor ID])
var _count1=COUNTROWS(FILTER(ALL(SupplierPerformance),'SupplierPerformance'[Vendor ID]=_Ven&&YEAR('SupplierPerformance'[Receive Date])=_year&&'SupplierPerformance'[Status]="On Time"))
var _count2=COUNTROWS(FILTER(ALL(SupplierPerformance),'SupplierPerformance'[Vendor ID]=_Ven&&YEAR('SupplierPerformance'[Receive Date])=_year))
return
DIVIDE(_count1,_count2)
3. Result:
The date of the slicer and the date of the line chart are used in the Date table [Date]
Put [OTD %_1111] to Secondary values
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
This is exactly what I was looking for even though I have no idea what the codes are doing. I tried to understand SelectedValue but ended up getting confused. If you don't mind would it be possible to explain the code for the 2 measures just a bit? I would like to use this elsewhere too.
Either way thank you VERY much for this solution. Very much appreciated!
Thanks for your response. Let me clarify:
So I have 2 measures:
1.
Vendor ID | Vendor Name | Receive Date | Orig Del Date | Status | Days to Delivery |
ABC | ABC Company | 12/11/2019 | 12/24/2019 | On Time | -13 |
ABC | ABC Company | 12/11/2019 | 12/24/2019 | On Time | -13 |
ABC | ABC Company | 3/17/2020 | 3/31/2020 | On Time | -14 |
ABC | ABC Company | 6/25/2019 | 7/9/2019 | On Time | -14 |
XYZ | XYZ Company | 7/23/2019 | 8/6/2019 | On Time | -14 |
XYZ | XYZ Company | 7/26/2019 | 8/9/2019 | On Time | -14 |
ABC | ABC Company | 8/26/2019 | 9/9/2019 | On Time | -14 |
Issue Date | Discrepancy | Vendor Name | Vendor ID |
3-May-22 | Bad connection | ABC Company | ABC |
22-Jan-22 | Defect part | ABC Company | ABC |
5-Mar-22 | Defect part | XYZ Company | XYZ |
8-Apr-21 | Damaged pin | ABC Company | ABC |
1-Feb-21 | Bad connection | XYZ Company | XYZ |
yes, that's pretty much the essence of what Power BI (and any other BI tool) provides.
Please provide sanitized sample data that fully covers your issue. If you paste the data into a table in your post or use one of the file services it will be easier to assist you. I cannot use screenshots of your source data.
Please show the expected outcome based on the sample data you provided. Screenshots of the expected outcome are ok.
https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
94 | |
83 | |
67 | |
59 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |