The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
I used the following DAX to return total "Approved" amounts across all datanameshorts in my dfact table. When datanameshort is either "SBG" or "SBG10" the total of "Approved" and "Paid" amounts must be returned instead.
As datanameshort is a column I needed to use selectedvalue to get a single value out of all values in the column and looks like that makes the condition to be always False (only else part gets executed)
Does anyone have any idea how to fix this.
a screenshot of the dfact table is added
Solved! Go to Solution.
The problem is that there is more than value for data name short, so SELECTEDVALUE will return blank.
Try
ApprovedAmount =
IF (
NOT ISEMPTY ( INTERSECT ( VALUES ( DFACT[DATANAMESHORT] ), { "SBG", "SBG10" } ) ),
CALCULATE (
SUM ( DFACT[AMOUNT] ),
DFACT[DATANAMESHORT]
IN { "SBG", "SBG10" }
&& DFACT[STATUS]
IN { "Approved", "Paid" } && NOT ISBLANK ( DFACT[GEONAME] )
),
CALCULATE ( SUM ( DFACT[AMOUNT] ), DFACT[STATUS] = "Approved" )
)
How are you using the measure? Is it in a visual which includes the data name short column or is it just in aggregation ?
I have it in a table with datname as below:
Small Business Disaster Recovery Grants represents both "SBG" and "SBG10".
I've used a similar aggregated measure in a card without any issues but in the table instead of getting the sum of "Approved" and "Paid" for "Small Business Disaster Recovery Grants" I am getting only "Approved".
The aggregated mesure is as follows:
The problem is that there is more than value for data name short, so SELECTEDVALUE will return blank.
Try
ApprovedAmount =
IF (
NOT ISEMPTY ( INTERSECT ( VALUES ( DFACT[DATANAMESHORT] ), { "SBG", "SBG10" } ) ),
CALCULATE (
SUM ( DFACT[AMOUNT] ),
DFACT[DATANAMESHORT]
IN { "SBG", "SBG10" }
&& DFACT[STATUS]
IN { "Approved", "Paid" } && NOT ISBLANK ( DFACT[GEONAME] )
),
CALCULATE ( SUM ( DFACT[AMOUNT] ), DFACT[STATUS] = "Approved" )
)
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
18 | |
18 | |
17 | |
15 | |
13 |
User | Count |
---|---|
36 | |
35 | |
19 | |
18 | |
18 |