Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hi, My name is Oki and im new here but already do a search with similar case and i still don't get my answer..
hope you guys can help.. here is my case
so, i have gauge that show a precentage data, what i need is that gauge show this month data as a default but user can also pick another month data (previous or next) with the column chart below (image).
and here is what i already try :
IF(MONTH(NOW())=[ThisMonth],CALCULATE(DIVIDE(SUM(MASTER[Achieve in Ton]),[TotalTargetDisti_Ton]),[ThisMonth]),DIVIDE(SUM(MASTER[Achieve in Ton]),[TotalTargetDisti_Ton]))
Solved! Go to Solution.
@Oki Still seems like half the information and the tables aren't text so can't copy and paste into an Enter Data query and test out the code. So, winging it you would want to create 2 columns:
Month Year = FORMAT([Date],"mmm-yy")
Month Year Sort = FORMAT([Date],"yyyymm") + 0
Then maybe something like:
Gauge Measure =
VAR __MonthYear = MAX('Table'[Month Year Sort])
VAR __Table =
SUMMARIZE(
FILTER('Table',[Month Year Sort] = __MonthYear),
"__Target", [Target in Ton Measure],
"__Achieve", SUM('Table'[Achieve in Ton])
)
VAR __Percent = DIVIDE(MAXX(__Table,[__Achieve]), MAXX(__Table, [__Target]))
RETURN
__Percent
Set your Sort By column for Month Year to Month Year Sort and use Month Year in your slicer. The theory here is that your table only contains data up until "current" so the MAX is always the "current" month. But, if they select something in the slicer (it is initally all values by default) then the MAX will return whatever they have chosen.
Hi, @Greg_Deckler
i want to say Thanks, cause it already solved..!
i just change in gauge measure :
VAR _MonthYear = MAX('Table'[MonthYearSort])
into
VAR _MonthYear = VALUE(FORMAT(TODAY(),"YYYYMM"))
@Oki Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882
Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.
Hi @Greg_Deckler
if i describe in excel, the data is like this
the "1" table is original data
the "2" table is the precentage per month
what i want is the gauge will show the "Mar-23" data as the default which is "54%" because this month is "March"
but if i have a slicer that contain "Dec-22", "Jan-23", "Feb-23", Mar-23". Then i click "Dec-22", the gauge will show "104%"
i hope this can help you understand what i need
@Oki Still seems like half the information and the tables aren't text so can't copy and paste into an Enter Data query and test out the code. So, winging it you would want to create 2 columns:
Month Year = FORMAT([Date],"mmm-yy")
Month Year Sort = FORMAT([Date],"yyyymm") + 0
Then maybe something like:
Gauge Measure =
VAR __MonthYear = MAX('Table'[Month Year Sort])
VAR __Table =
SUMMARIZE(
FILTER('Table',[Month Year Sort] = __MonthYear),
"__Target", [Target in Ton Measure],
"__Achieve", SUM('Table'[Achieve in Ton])
)
VAR __Percent = DIVIDE(MAXX(__Table,[__Achieve]), MAXX(__Table, [__Target]))
RETURN
__Percent
Set your Sort By column for Month Year to Month Year Sort and use Month Year in your slicer. The theory here is that your table only contains data up until "current" so the MAX is always the "current" month. But, if they select something in the slicer (it is initally all values by default) then the MAX will return whatever they have chosen.
@Greg_Deckler
oh great! this exactly what i need,,
but the problem is my data till december 2023
is there a way to solved this?
here's the data sample
Date | Achieve in Ton | Target in Ton |
29-Dec-22 | 150 | 4.000 |
29-Dec-22 | 150 | |
19-Dec-22 | 2.400 | |
19-Dec-22 | 1.440 | |
16-Jan-23 | 1.260 | 4.000 |
16-Jan-23 | 420 | |
11-Jan-23 | 480 | |
11-Jan-23 | 480 | |
21-Feb-23 | 2.880 | 5.500 |
16-Feb-23 | 1.440 | |
23-Feb-23 | 960 | |
24-Feb-23 | 480 | |
1-Mar-23 | 600 | 6.000 |
3-Mar-23 | 1.200 | |
8-Mar-23 | 1.440 | |
1-Apr-23 | 1.000 | |
1-May-23 | 1.000 |
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.